Skip to main content
July 16, 2009
Answered

JS CS4: Adding graphicline to a specific layer and page

  • July 16, 2009
  • 1 reply
  • 1218 views

Here is what I have so far (that does not work)

myOutsideGuide_Left = app.activeDocument.layers.item ("Die"). graphicLines.add ();
myOutsideGuide_Left.geometricBounds = ["1 in", "1 in", "2 in", "3 in"];

or

myOutsideGuide_Left = app.activeDocument.pages.item[0].graphicLines.add ();
myOutsideGuide_Left.geometricBounds = ["1 in", "1 in", "2 in", "3 in"];

If I use:

myOutsideGuide_Left = app.activeDocument.graphicLines.add ();
myOutsideGuide_Left.geometricBounds = ["1 in", "1 in", "2 in", "3 in"];

it will produce a line on the active page and layer.

Conundrum: How do I designate the page and layer when creating the graphic line?

There is a beer in for you.

Thank you,

John

This topic has been closed for replies.
Correct answer Kasyan Servetsky

Page: either

myOutsideGuide_Left = app.activeDocument.pages[0].graphicLines.add ();
myOutsideGuide_Left.geometricBounds = ["1 in", "1 in", "2 in", "3 in"];

or

myOutsideGuide_Left = app.activeDocument.pages.item(0).graphicLines.add ();
myOutsideGuide_Left.geometricBounds = ["1 in", "1 in", "2 in", "3 in"];

Layer:

myOutsideGuide_Left = app.activeDocument.pages[0].graphicLines.add (app.activeDocument.layers.item ("Die"));
myOutsideGuide_Left.geometricBounds = ["1 in", "1 in", "2 in", "3 in"];

P.S. I'm on CS3 — haven't tested this on CS4.

1 reply

Kasyan Servetsky
Kasyan ServetskyCorrect answer
Legend
July 16, 2009

Page: either

myOutsideGuide_Left = app.activeDocument.pages[0].graphicLines.add ();
myOutsideGuide_Left.geometricBounds = ["1 in", "1 in", "2 in", "3 in"];

or

myOutsideGuide_Left = app.activeDocument.pages.item(0).graphicLines.add ();
myOutsideGuide_Left.geometricBounds = ["1 in", "1 in", "2 in", "3 in"];

Layer:

myOutsideGuide_Left = app.activeDocument.pages[0].graphicLines.add (app.activeDocument.layers.item ("Die"));
myOutsideGuide_Left.geometricBounds = ["1 in", "1 in", "2 in", "3 in"];

P.S. I'm on CS3 — haven't tested this on CS4.

July 16, 2009

Thank you!

It works in CS4.

John