Copy link to clipboard
Copied
According to the documentation - "The PageItem class gives yo complete access to every art item contained in an Illustrator document." Unfortunately I cannot figure out how the art item is connected to the PageItem.
My particular case is that I want to change the contents of a textFrame. I would like to use the UUID of the pageItem to locate the textFrame. Something like this:
var pageItem = app.activeDocument.getPageItemFromUuid(uuid)
//now I want to get the textFrame so I would like to do something like this:
var textFrame = textFrame.getFromPageItem(pageItem)
textFrame.contents = "Updated value"
Any ideas would be appreciated!
I think I figured this out. It appears that you can simply treat the pageItem like the associated art item. So the solution would be:
var pageItem = app.activeDocument.getPageItemFromUuid(uuid)
//pageItem now acts like a textFrame so we can use the textFrame properties on it
pageItem.contents = "Updated value"
Copy link to clipboard
Copied
I think I figured this out. It appears that you can simply treat the pageItem like the associated art item. So the solution would be:
var pageItem = app.activeDocument.getPageItemFromUuid(uuid)
//pageItem now acts like a textFrame so we can use the textFrame properties on it
pageItem.contents = "Updated value"
Copy link to clipboard
Copied
pageItem and art item refer to the same thing.
getFromPageItem() is not a function, at least not in illustrator api
in your last example, you're not providing the item uuid, so your snippet shouldn't work as provided.
Copy link to clipboard
Copied
Thanks!
Not sure why you are mentioning getFromPageItem(). I don't use that in my examples. getPageItemFromUUID was added in CC 24 (https://illustrator-scripting-guide.readthedocs.io/introduction/changelog/)
Copy link to clipboard
Copied
sorry, I thought I saw it, I guess my eyes played a trick on me.
Copy link to clipboard
Copied
oh well, at least I know I'm not crazy.