Skip to main content
Known Participant
May 18, 2008
Question

[JS] Move a Guide that has a ScriptLabel

  • May 18, 2008
  • 20 replies
  • 3819 views
I am trying move a specific guide. The guide is on the master page and is named myGuide

Here is what I currently trying, but it doesn't work.
app.activeDocument.guides.item("myGuide").location = 2

Thanks in advanced for any help.
Dan

P.S. I will this to work in CS2 and CS3.
This topic has been closed for replies.

20 replies

Inspiring
May 22, 2008
On 22/5/08 8:58 PM, "Harbs" <member@adobeforums.com> wrote:<br /><br />> It was more of a question as to why the difference...<br />> <br />I always found it strange in the old days when graphics were page items. I<br />mean, if there's one item that can *never* belong to a page...<br /><br />-- <br />Shane Stanley <sstanley@myriad-com.com.au>
Inspiring
May 21, 2008
On 20/5/08 4:26 PM, "Harbs" <member@adobeforums.com> wrote:<br /><br />> But, I'm almost positive that guides *are* page items -- on the C++<br />> level.<br /><br />Perhaps, but not on a scripting level. Ask for allPageItems...<br /><br />-- <br />Shane Stanley <sstanley@myriad-com.com.au>
Harbs.
Legend
May 22, 2008
Shane_Stanley@adobeforums.com wrote:
>> Perhaps, but not on a scripting level. Ask for allPageItems...
>>
Yes I know. I didn't mean to disagree. It was more of a question as to
why the difference...

Harbs
Peter Kahrel
Community Expert
Community Expert
May 20, 2008
That sounds very useful -- thanks.

Peter
Harbs.
Legend
May 22, 2008
Peter Kahrel wrote:
> That sounds very useful -- thanks.
I'll be happy to beat that drum too... *It is very useful!!!*

What Kris wrote just barely scratches the surface. APID makes possible,
stuff you haven't even dreamed of...

(I've been using it very extensively over the last year or so... and
here are some of the results: www.in-tools.com )

P.S. the site should be totally live in a few days.

Harbs
Inspiring
May 20, 2008
FYI - beating my own drum here, but I think this might be helpful: by installing our free 'APID ToolAssistant' (formerly Active Page Items Runtime) plug-in, you gain some additional script functionality in CS/CS2/CS3.

Amongst a host of other functionality, it's also a bit of a grab-bag of functionality we needed to get in ExtendScript for our own use - each time we needed a new feature, we just plunked it into the plug-in and made it accessible via the ExtendScript DOM.

One of the things is that it adds an event called 'labeledPageItems' to the Document object, which returns an array (not a collection) of all matching items. For example, if I have a document that contains a frame, and two guides that all have the label 'test' assigned, the following script returns an array that contains all of them:

var theDoc = app.activeDocument;
var theItems = theDoc.labeledPageItems("test");
alert(theItems);

labeledPageItems accepts wildcard expressions (not grep - just simple wildcards; "*" = zero or more chars, "?" = exactly one char) - so you can do things like:

var theDoc = app.activeDocument;
var theItems = theDoc.labeledPageItems("t*");
alert(theItems);

to grab all page items whose label starts with 't'.

There are some more options (e.g also select by layer or spread).

If you install the plug-in you can inspect some short docs via the ExtendScript Object Model viewer.

Other interesting freely available features are:
- a progress bar window with optional Cancel button for use with long-running scripts in InDesign CS/CS2 (which became obsolete, but is still functional in CS3),
- clearing the InDesign undo stack during long running scripts,
- temporarily locking InDesign into a fake 'modal mode' (so the user cannot interfere with it while you're juggling things with scripts and external programs - I use it to make fake 'modal dialogs' that seem to originate from InDesign, but are really created from a REALbasic app),
- etc...

The latest APID ToolAssistant 1.0.45 adds a new event Document.multiPropertyAssign, which allows you to assign a whole collection of objects and attributes new values in one event call - which represents a single undo, and seems to speed up some scripts (the jury is still out - in some situations, there is marked improvement, in other situations it's actually slower). Docs can be seen via the ExtendScript toolkit.

What's available in ExtendScript is a bit of a hodgepodge as it is mostly driven by our own needs rather than by design.

This part of the functionality of the plug-in is all free (as in 'at no cost') - APID ToolAssistant has two modes (licensed and unlicensed), and you can use this stuff with an unlicensed version installed; check the docs for more info.

http://www.rorohiko.com/apidtoolassistant.html
http://www.rorohiko.com/activepageitemsdeveloper.html
(the downloadable demo of APID contains PDF documentation that is relevant to the free APID ToolAssistant)

Hope it's useful!

Cheers,

Kris
Participating Frequently
April 17, 2009

Hi RorohikoKris

you wrote: "clearing the InDesign undo stack during long running scripts"

Is it possible to completly deactivate the undo stack functionality in CS3? Or do I have to clear the array periodically? I already read the post: http://forums.adobe.com/message/1110044#1110044 but i need a solution for CS3? If not with the Scripting API perhaps with a c++ plugin?

Cheers Tino

Harbs.
Legend
April 17, 2009

http://www.rorohiko.com/wordpress/indesign-downloads/active-page-item-developer/

APID has a function for clearing the undo stack. I don't think there's

a way to disable it completely -- not even with C++.

Harbs

http://www.in-tools.com

Peter Kahrel
Community Expert
Community Expert
May 19, 2008
Fair enough -- thanks.

Peter
Known Participant
May 19, 2008
Hi Peter,

We created a special case for page items because it was useful. At the time, we had to argue that it was so useful that it was worth keeping even though it was inconsistent.

I agree that it would be great to be able to use it with guides--or any other object that has a label. I doubt, however, that we have the resources to add this feature anytime soon.

Thanks,

Ole
Peter Kahrel
Community Expert
Community Expert
May 19, 2008
>A guide does not have a name property

But it does have a label, and it's sort of usable. It still doesn't make any sense to me why certain object can be addressed using their label, and others not.

Peter
Known Participant
May 19, 2008
Hi Dave,

I've said before that that is probably an error. It's nice that it works, though.

Thanks,

Ole
Inspiring
May 19, 2008
Tables don't have names either, but they support itemByName corectly.

Dave
Known Participant
May 19, 2008
Hi Dave, Peter,

It looks to me as if this is an error in the way that InDesign generates the XML file for the ESTK to use. A guide does not have a name property, so it shouldn't have an item by name method.

Thanks,

Ole