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

JS CS4: strokeDashAndGap question

Guest
Jul 21, 2009 Jul 21, 2009

var myOutsideGuide_Left = app.activeDocument.pages[0].graphicLines.add (app.activeDocument.layers.item ("Die"));
myOutsideGuide_Left.geometricBounds = ["0 in", "3 in", "10 in", "3 in"];
myOutsideGuide_Left.strokeDashAndGap = ["3 p", "3 p","3 p","3 p"];
myOutsideGuide_Left.strokeColor = app.activeDocument.colors.item("Black");

"myOutsideGuide_Left.strokeDashAndGap = ["3 p", "3 p","3 p","3 p"];" this line errors out and I'm stumped at what I'm missing.

Insight is greatly appreciated.

Thank you,

John

TOPICS
Scripting
1.6K
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

Community Expert , Jul 22, 2009 Jul 22, 2009

myOutsideGuide_Left.strokeType = "Dashed";

It seems you can only set the dash properties if the line is tagged as 'being dashed' in the first place!

Translate
Community Expert ,
Jul 22, 2009 Jul 22, 2009

myOutsideGuide_Left.strokeType = "Dashed";

It seems you can only set the dash properties if the line is tagged as 'being dashed' in the first place!

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
Guest
Jul 22, 2009 Jul 22, 2009


Thank you very much for taking the time to help with novice questions. It is greatly appreciated.

To recap:

(the following is for other uninitiate like me)

var myOutsideGuide_Left = app.activeDocument.pages[0].graphicLines.add (app.activeDocument.layers.item ("Die"));
myOutsideGuide_Left.geometricBounds = ["0 in", "3 in", "10 in", "3 in"];
myOutsideGuide_Left.strokeType = "Dashed";
myOutsideGuide_Left.strokeDashAndGap = ["3 p", "3 p","3 p","3 p"];
myOutsideGuide_Left.strokeColor = app.activeDocument.colors.item("Black");

Not using "myOutsideGuide_Left.strokeDashAndGap = ["3 p", "3 p","3 p","3 p"];" will use the default of whatever dash and gap is recorded in the stroke palette "Dashed" setting.

Thanks again for the help!

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 ,
Jul 22, 2009 Jul 22, 2009
... whatever dash and gap is recorded in the stroke palette "Dashed" setting ..

I was wondering about that. This will still fail on other language versions of InDesign (because "Dashed" will be "Gestrichelt" or something like that), but I can only find one way of setting a line to a dashed style without knowing the name: loop over all stroke styles and use the first one that has a property "dashArray". Seems a bit ... troublesome?

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 ,
Jul 22, 2009 Jul 22, 2009

Hi, Jongware!

$ID/

does it:

myOutsideGuide_Left.strokeType = "$ID/Dashed";

I tested that line on a German version of InDesign CS4 6.0.3 and InDesign CS3 5.0.4 on Mac OS X 10.5.7.

Without "$ID/" there was an error.

Greetings,

Uwe

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 ,
Jul 22, 2009 Jul 22, 2009

Hi Uwe,

Thanks for posting that! It seems this invokes the built-in auto-translator, and having an English version only, no way I could have found that out, or even could've checked if it worked ...

Theun (aka [Jongware])

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 ,
Jul 22, 2009 Jul 22, 2009
LATEST

Hi, Theun!

Search for "$ID/" or "Localization" in the pdf or html-documentation of the InDesign CS4 SDK:

Feature development with Scripting.pdf

p12 "Localization"

or to clarify the issue:

ar42s03s05.html

see also:

idml-specification.pdf

p224 "IDML Example 62. Default StrokeStyles"

Greetings,

Uwe

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