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

Reference to object by ID (Applescript)

Explorer ,
Mar 31, 2009 Mar 31, 2009
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
TOPICS
Scripting
2.0K
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
Advocate ,
Mar 31, 2009 Mar 31, 2009
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
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
Explorer ,
Mar 31, 2009 Mar 31, 2009
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
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
Explorer ,
Apr 02, 2009 Apr 02, 2009
LATEST
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
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