Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

JS: Text StrokeWeight

Participant ,
Oct 11, 2012 Oct 11, 2012

How to get the Text's StrokeWeight value in the TextFrame (not refering to the Frame stroke weight)

Please help... Thank you very much.

TOPICS
Scripting
1.9K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Enthusiast , Oct 11, 2012 Oct 11, 2012

Be sure to select text with equal formatting.

//ID CS 5.5

var strokeMeasurementUnit = app.viewPreferences.strokeMeasurementUnits.toString();

var mySel = app.selection[0];

alert('Strokecolourname: ' + mySel.strokeColor.name + ' \n '    + 'Strokeweight: ' + mySel.strokeWeight + ' ' + strokeMeasurementUnit)

Translate
Enthusiast ,
Oct 11, 2012 Oct 11, 2012

Hi,

those are quite normal properties in the text suite:

//select some text

with(app.selection[0]){

strokeAlignment    =  TextStrokeAlign.CENTER_ALIGNMENT;//TextStrokeAlign.OUTSIDE_ALIGNMENT

strokeColor     = 'C=75 M=5 Y=100 K=0';

strokeWeight    = '1 pt'

        }

Hope it'll work

Hans-Gerd Claßen

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Oct 11, 2012 Oct 11, 2012

Thanks for the reply.

i don't mean to set the text strokeWeight style in the document, but am trying to use a script to find out the text's stroke properties on page.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Oct 11, 2012 Oct 11, 2012

to be more specific, i'm trying to use JS to find out a particular (selected) text's stroke weight and it's color.

Thanks

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Oct 11, 2012 Oct 11, 2012

Be sure to select text with equal formatting.

//ID CS 5.5

var strokeMeasurementUnit = app.viewPreferences.strokeMeasurementUnits.toString();

var mySel = app.selection[0];

alert('Strokecolourname: ' + mySel.strokeColor.name + ' \n '    + 'Strokeweight: ' + mySel.strokeWeight + ' ' + strokeMeasurementUnit)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Oct 11, 2012 Oct 11, 2012

Thanks so much 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 11, 2012 Oct 11, 2012

app.selection[0].strokeWeight                    //Stroke weight of the text

app.selection[0].strokeColor.colorValue     //Stroke Color of the text

Code is based on the premise that the selection is on a text.

Manan Joshi

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 11, 2012 Oct 11, 2012
LATEST

Manan, please trim your signature in the future. Thanks.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines