Thread View: adobe.scripting.indesign
4 messages
4 total messages
Started by Peter_Bossens
Tue, 31 Mar 2009 12:32
Reference to object by ID (Applescript)
Author: Peter_Bossens
Date: Tue, 31 Mar 2009 12:32
Date: Tue, 31 Mar 2009 12:32
15 lines
973 bytes
973 bytes
Applescript - InDesign CS2 I would like to check some attributes of an object within a document from which I know the ID. How can I reference to this object using applescript? Suppose the ID is "3102", I would expect someting like: set myObject to item id 3102 if name of fill color of myObject is .... then ... or: select myObject .... ...but this does not work! Any suggestions? Thanks, Peter
Re: Reference to object by ID (Applescript)
Author: Dirk_Becker
Date: Tue, 31 Mar 2009 19:10
Date: Tue, 31 Mar 2009 19:10
35 lines
1382 bytes
1382 bytes
The class of objects addressed by ID is not checked - probably a minor bug. Most of these IDs (except XML elements) are unique across the classes. You can take advantage of that by using any class. The resulting object will have the correct class anyway.
I would prefer to suggest you use some generic base class instead, but "Object" does not work.
tell application "Adobe InDesign CS4"
tell active document
get id of page 1
-- 190
get class of character style id 190
-- page
get side of page id 190
-- right hand
get side of character style id 190
-- right hand
end tell
end tell
Dirk
Re: Reference to object by ID (Applescript)
Author: Olav_Kvern
Date: Tue, 31 Mar 2009 19:17
Date: Tue, 31 Mar 2009 19:17
11 lines
1003 bytes
1003 bytes
Hi Peter, In addition to what Dirk said (thanks, Dirk!), I'd point out that "item" does not refer to anything in your example. Something like this, on the other hand, should work (provided that the object being addressed through the "tell" block contains page items): set myObject to page item id 3102 Thanks, Ole
Re: Reference to object by ID (Applescript)
Author: Peter_Bossens
Date: Thu, 02 Apr 2009 15:15
Date: Thu, 02 Apr 2009 15:15
5 lines
797 bytes
797 bytes
Olav, Dirk, thanks a lot, it works! In my tests, I used "item id" instead of "page item id". From the answer of Dirk, I learned how to get the side of the page, also something I was searching for! Peter
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads