Copy link to clipboard
Copied
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
It this JavaScript?
You should use app.activeDocument.textFrames.itemByID(3771).
Where did you find this .item.id() syntax?
Copy link to clipboard
Copied
It this JavaScript?
You should use app.activeDocument.textFrames.itemByID(3771).
Where did you find this .item.id() syntax?
Copy link to clipboard
Copied
Hi John, and thanks
Consider me an absolute noob. Yes this is JavaScript. I found fragments within another script which I thought would work, but didn't. With your correction, and some further research it now looks like this:
var textblock = app.activeDocument.textFrames.itemByID(3771);
textblock .move( [0, 4] );
but still doesn't move the textframe.
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
Didn't think it was relevant, but here you go (an instance of "textFrame.id", from InDesignCS5_ScriptingGuide_JS.pdf)
http://dl.dropbox.com/u/5420164/Screen%20shot%202012-04-26%20at%2016.11.00.png
The id was wrong, just like you said.
This line now works:
app.activeDocument.textFrames.itemByID(3768).move( [0, 4] );
Copy link to clipboard
Copied
Note that you can in fact use inline images here...
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!