Skip navigation
PrntScr
Currently Being Moderated

Adressing an object by it's id

Apr 25, 2012 7:37 AM

I'm failing to write a line that will adress a textframe by id (which is 3771) and then move it.

 

This is how my attempt looks:

app.activeDocument.textFrames.item.id(3771).move([0, 0, 7, 2]);

 

Any help is appreciated

 
Replies
  • John Hawkinson
    5,572 posts
    Jun 25, 2009
    Currently Being Moderated
    Apr 25, 2012 7:46 AM   in reply to PrntScr

    It this JavaScript?

    You should use app.activeDocument.textFrames.itemByID(3771).

    Where did you find this .item.id() syntax?

     
    |
    Mark as:
  • John Hawkinson
    5,572 posts
    Jun 25, 2009
    Currently Being Moderated
    Apr 25, 2012 7:58 AM   in reply to PrntScr

    Your answer to "where?" is "somewhere" but not-gonna-say? I see.

     

    Are you sure your ID is correct? What if you use

     

    var textblock = app.activeDocument.textFrames[0];

     

    ? Are your units set reasonably so that you would see a [0,4] move?

    Do you get an error?

     
    |
    Mark as:
  • John Hawkinson
    5,572 posts
    Jun 25, 2009
    Currently Being Moderated
    Apr 26, 2012 10:01 AM   in reply to PrntScr

    Note that you can in fact use inline images here...

    Screen shot 2012-04-26 at 16.11.00.png

    Anyhow, I guess you've figured it out, but

     

    var myID = myTextFrame.id;

     

    merely sets myID to the ID number of the text frame. It doesn't mean that you can add parens after id() and parametrize an index through it.

     

    Glad you got it working!

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points