Highlighted

Using the AI Scripting Reference manual

Participant ,
Oct 29, 2020

Copy link to clipboard

Copied

Hello,

Apparently, it is not possible to set an artobard's artboardRect property individually, for example artboardRect[0] for the left position of the artboard. The artboardRect property must be set all at once to take effect, in other words, an array with four values corresponding to [left, top, right, bottom] must be passed to it. Assuming this is true, how am I supposed to gather this requirement when reading the Scripting Reference manual? The manual just reads:

artboardRect    rect    Size and position of the arboard.

In fact, how am I supposed to gather from the Scripting Reference manual that rect for rectangle is defined by the following parameters [left, top, right, botom]?

Obviously, I feel a lot of other items in the document lack the necessary information for correct usage so I thought perhaps I am not using that document properly.

 

This is for CS4.

Thanks.

 

 

TOPICS
Scripting

Views

104

Likes

Translate

Translate

Report

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

Using the AI Scripting Reference manual

Participant ,
Oct 29, 2020

Copy link to clipboard

Copied

Hello,

Apparently, it is not possible to set an artobard's artboardRect property individually, for example artboardRect[0] for the left position of the artboard. The artboardRect property must be set all at once to take effect, in other words, an array with four values corresponding to [left, top, right, bottom] must be passed to it. Assuming this is true, how am I supposed to gather this requirement when reading the Scripting Reference manual? The manual just reads:

artboardRect    rect    Size and position of the arboard.

In fact, how am I supposed to gather from the Scripting Reference manual that rect for rectangle is defined by the following parameters [left, top, right, botom]?

Obviously, I feel a lot of other items in the document lack the necessary information for correct usage so I thought perhaps I am not using that document properly.

 

This is for CS4.

Thanks.

 

 

TOPICS
Scripting

Views

105

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Oct 29, 2020 0
Participant ,
Oct 29, 2020

Copy link to clipboard

Copied

Hello hello, if you want change one border only for example left border, you can write it :

var myArtboard = app.activeDocument.artboards[0];

myArtboard.artboardRect = [

  100,

  myArtboard.artboardRect[1],

  myArtboard.artboardRect[2],

  myArtboard.artboardRect[3]

];

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 29, 2020 1
Participant ,
Oct 29, 2020

Copy link to clipboard

Copied

Hi Steven. You are assigning all four values. Try myArtboard.artboardRect[0] = 100 and see if it takes the value!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 29, 2020 0
Participant ,
Oct 29, 2020

Copy link to clipboard

Copied

Maybe, I misunderstood your question ^^. I think you can't assign one value for one item only, when property accept one Point value or Rect value, you reassign others value in same instruction.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 29, 2020 0
Engaged ,
Oct 29, 2020

Copy link to clipboard

Copied

Unfortunately, that's the way it is with the scripting references.  To make ​matters worse, there are things left out of the references completely, even though they have been an open secret for years.  I suspect that this is apathy rather than cynicism.  On a positive note, this forum will more often than not give you the answer you're looking for. 

 

Edit:  Similarly, I seem to remember that the x and y elements of the "position" property cannot be assigned individually, i.e. "position" must be assigned an array [x, y].  

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 29, 2020 1
Participant ,
Oct 29, 2020

Copy link to clipboard

Copied

Hi Femke,

You must be right. I struggle to get my head around this reference document sometimes (most of the time, I should say). Some of the entries have examples but many don't. It's unfortunate because the presumably missing information really reduces the value of an otherwise well-intended document. As usual with such things, I uncover the issue through an error and waste time trying to figure out whether I am doing something wrong or if it's a bug! Well here, it seems I was doing something wrong thanks to a lack of explanation, at least it's not a bug.  😉

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 29, 2020 0
Explorer ,
Nov 03, 2020

Copy link to clipboard

Copied

The documentation is terrible, and in some ways getting worse as I don't think there's even been an official update for AI since 2017 - I guess all their efforts are being directed towards UXP.

 

So it's pretty much been left to the community! 

 

The best resources I've found are the open-source community-contributed docs here: https://docsforadobe.dev/

 

Then @CarlosCanto  updates these forums with everything new he is able to reverse engineer from each release:

https://community.adobe.com/t5/illustrator/what-s-new-in-illustrator-scripting-cc2021/m-p/11530254?p...

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 03, 2020 1
Resources