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

how to select textframe(any object) by its ID?

New Here ,
Feb 25, 2009 Feb 25, 2009
very short question.
this doesn't work:
myIndi.Select myPage.PageItemID(1321)

what is right synthaxis?

thanks.
TOPICS
Scripting
1.8K
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
Community Beginner ,
Feb 25, 2009 Feb 25, 2009
myDoc.AllPageItems.ItemByID(1321)

or

myDoc.PageItems.ItemByID(1321)

robin

--
www.adobescripts.com
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
LEGEND ,
Feb 28, 2009 Feb 28, 2009
Robert Tkaczyk wrote:
> myDoc.AllPageItems.ItemByID(1321)
>

Robin,
Are you saying allPageItems is a collection in VB?

--
Harbs
http://www.in-tools.com
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
Community Beginner ,
Feb 28, 2009 Feb 28, 2009
yes

Property AllPageItems As Objects
read-only
Member of InDesign.Document
Lists all page items contained by the Document.

Property PageItems As PageItems
read-only
Member of InDesign.Document
The page items collection, which can be used to process all page items in a container (such as a document, page, or group), regardless of type.

robin

--
www.adobescripts.com
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
LEGEND ,
Mar 01, 2009 Mar 01, 2009
Robert Tkaczyk wrote:
> yes
>

??? I read that as: allPageItems is returned as an array (as it is in
JS). You can't use itemByID on an array. pageItems is a collection.

--
Harbs
http://www.in-tools.com
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
Community Beginner ,
Mar 01, 2009 Mar 01, 2009
in VB, when I run this code (after initialising connection to InDesign and to Document, etc.):

Private Sub Command3_Click()
MsgBox (TypeName(myDoc.AllPageItems.Item(1)))
MsgBox (TypeName(myDoc.PageItems.Item(1)))
End Sub


I'll have the same result twice, for example "TextFrame" if in my document first item is TextFrame

robin

--
www.adobescripts.com
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
LEGEND ,
Mar 01, 2009 Mar 01, 2009
Hmm.

Sounds like you're right in VB.

In JS though, this throws an error on the first line, but alerts the
object on the second:

try{alert(app.documents[0].allPageItems.item(1))}catch(e){alert(e)}
try{alert(app.documents[0].pageItems.item(1))}catch(e){alert(e)}

Interesting...

--
Harbs
http://www.in-tools.com
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
New Here ,
Feb 26, 2009 Feb 26, 2009
more correct (as i found):
myPage.PageItems.ItemByID(1321)

many thanks, Robert
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
Community Beginner ,
Feb 26, 2009 Feb 26, 2009
right 😉 you work on Page ;)

robin

--
www.adobescripts.com
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
New Here ,
Jan 19, 2010 Jan 19, 2010

Robert, I was hoping you could help me.  In your code: myPage.PageItems.ItemByID(1321), how do you obtain the ID#, in your case 1321?  Do you get it from the InDesign document?

Your help would be greatly appreciated.

Thank you,

Mike

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
LEGEND ,
Jan 22, 2010 Jan 22, 2010
LATEST

Econometric wrote:

Robert, I was hoping you could help me.  In your code: myPage.PageItems.ItemByID(1321), how do you obtain the ID#, in your case 1321?  Do you get it from the InDesign document?

Every object - except text (Text, Paragraph, Character, TextColumn, etc.) - have unique ID, so in ID CS3/4:

myTF_ID = myDoc.Stories.Item(1).TextContainers.Item(1).ID

Set myTF = myDoc.TextFrames.ItemById(myTF_ID)

This ID shouldn't change between save->close->open document, but you can't rely on it.

If you need to find particular object - you should use .Label property - but you need to be sure, that user won't change it. You can use .InsertLabel(myLabel, value) method - but then you can't use label assigned this way in .Item(myLabel) to retrieve this object.

robin

www.adobescripts.co.uk

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