Skip to main content
Participant
December 21, 2010
Question

change text frame horizontally (text area) with script?

  • December 21, 2010
  • 1 reply
  • 1618 views

Hi there,

I've posted this question at InCopy Scripting but I've seen that many answers there are unanswered and since someone with InDesign knowledge may be able to help, I decided to also post it here.

I'm trying something that might be simple but am not being able to solve... When I am inside a document I created (or one that I've opened), I want to be able to change the text frame horizontally.

What I'm trying to do is exactly what I can with File > Document Setup > Text Area - Width. If I shrink this number to, say 60 mm, the result is exactly what I want. But I haven't been able to find a way of doing it via javascript...

I have tried the sample scripts for an answer or this forum or the internet, but I don't know how to do it. And I have that feeling it is quite simple... Maybe by creating a script menu action? For example, if I call a:

app.menuActions.itemByName("Document Setup...").invoke();

I end up at the same place than the menu option - but if I can inform the parameter via script and not use the menu interface, that would be it.

Of course, if there is a better way of doing it, it is also welcome!

I'm using InCopy CS4.

thanks!

This topic has been closed for replies.

1 reply

Participant
December 23, 2010

The small steps I've been able to take so far are:

if (app.version == 3){

   theframe = app.selection[0].parentTextFrame.endTextFrame;

} else

   theframe = app.selection[0].parentTextFrames[0].endTextFrame;

Should select the text frame I'm trying to resize. Then:

theframe.geometricBounds = [ 50, 50, 50, 50 ];

Should do the resizing. However, it tells me "geometricBounds" is a read only property. I think this might be close, but I'm not quite grasping it... The funny thing is that using the menu as I described I am able to resize the width of the text frame...

Any hints? Is what I am asking possible? Please, any answer would really help!

thanks!
Participant
January 3, 2011