Align page items (AS) (CS3)

Scripting Gurus,
Is there some simple AS syntax to align selected page items on a page?
Dictionary seems to imply that, saying:
align distribute items page item : The page items to align or distribute.
align option left edges/top edges/right edges/bottom edges/horizontal centers/vertical centers : The type of alignment to apply.
I attempted this:
tell page items in selection
set vertical alignment to top edges
end tell
Thanks!
Joe

Its kinda of crazy but here ya go, I wish the AppleScript Dictionary listed  examples ...esp. when the syntax is wacky.
select a bunch of images, or have the object references in a list(I just use selection to make it easier):
tell application "Adobe InDesign CS3"
    tell active document
        set myimages to selection
        align align distribute items myimages align option left edges
    end tell
The text in the red is where you put those paramaters listed in the dictionary.
~Mike

Similar Messages

  • Align page item to region right edge.

    Hi gurus
    I have a region that has just one page item and I want to align it to right edge of its region.
    How can I do that?
    Thanks in advance
    Oscar

    Maheswara,
    Thanks for your answer.
    Really my region is a reports region of item-above-region-content type.
    And the only page item has to be right-aligned to match rigthmost columns.
    Can this info helps you?
    Oscar

  • Dynamic alignment of report column and page item value

    Hi friends,
    I have an interactive report which contains the columns like
    <li>empno
    <li>Name
    In the above i have "empno" with a column alignment of left and a "Name" with a column alignment of left.
    Whether it is possible to override the data alignment that we set in the report according to the value of the application item like
    If my application item value is US, then i need the column alignment of both the column"empno" and "Name" to be left and if my application item value is AR, then i need the column alignment of both the column "empno" and "Name" to be right. Whether is it possible to achieve the dynamic alignment to the report data of both the columns "empno" and "Name" according to the application page item value.
    And also in the case of page item i have a page item with a name P1_NAME in which it has a Element Horizontal/Vertical alignment to left.
    I need that element alignment of the page item to behave dynamically according to the application page item, like if the application page item is US then the element alignment of the page item has to be left and if the application page item is AR then the element alignment of the page item has to be right.
    Whether is it possible to achieve my above two scenario's friends. Kindly help me with this.
    Thanks in advance.
    Brgds,
    Mini

    Kees,
    Your approach is excellent and brilliant:-)
    I tried with your steps and i can achieve those alignment in both ways like you said(either on page load/through DA).
    But im going with the DA way. I have certain query regarding this kees.
    <li>Suppose if the report, is classic whether i can go with the same approach that i have achieved alignment with the IR report.
    <li>Currently through the DA way, i used the page item in the condition. Is it possible to use the application item instead of page item in DA. Because im going to use the application item FSP_LANGUAGE_PREFERENCE for getting the code either 'AR' or 'US'.
    <li>Finally i need this kind of restriction for the page item also, consider like i have a page item P1_X with an Element Vertical/Horizontal alignment as left. Now i need to change that alignment to right according to the application page item value, hence i can give application item condition for the page item like below
    PL-SQL EXPRESSION: :FSP_LANGUAGE_PREFERENCE = 'AR'
    i need the element alignment of the page item to behave dynamically suppose if the application item value is AR then the element alignment of that page item has to be right if the application item value is US then the element alignment of that page item has to be left, irrespective of the page item Element Vertical/Horizontal alignment that was set to it.
    Thanks for your kind help
    Brgds,
    Mini

  • [AS CS3] Bug? All Page Items - grouped items w labels

    Can anyone confirm this behaviour for me. I would classify it as a bug, but maybe the logic for it not being a bug escapes me.
    The command "all page items" is supposed to return a (flat) list of every page object, right? I would suspect that I should be able to address any object in the list. But I can only seem to address an object when it's inside of a group.
    I am trying to get the text of a text frame that has a label. It may or may not be inside a group. I can certainly do a try/error block to try a script statement for objects in a group or not in a group. But I think that "all page items" should be able to handle it directly.
    Here's a test script: ------
    tell application "Adobe InDesign CS3"
    tell document 1
    get label of all page items
    set myUngrouped to contents of text frame "some label" --only works when objects ungrouped, this is expected
    set myText to (get contents of text frame "some label" of all page items)
    --both statements work ONLY when objects grouped
    set myText to (get contents of every page item of all page items whose label is "some label")
    end tell
    end tell
    Steps:
    Make a new document.
    Draw a text frame. Type some text into it.
    Label the frame "some label".
    Draw another empty graphic or text frame.
    Run script
    -->result is, myText statements error out. Why is this?
    Now group all items on page.
    Run script.
    -->result is, myUngrouped can't continue. This is expected.
    Comment out myUngrouped statement
    Run script.
    -->result is, myText statements work OK.

    On 19/8/08 1:14 AM, "SuperMacGuy" <[email protected]> wrote:<br /><br />> set myText to (get contents of every page item of all page items whose label<br />> is "some label") <br /><br />The syntax is a bit tricky. The key is that all page items returns a list,<br />so what you want is certain items -- not page items -- from that list. So:<br /><br />set myText to (every item of all page items whose label is "some label")<br /><br /><br />-- <br />Shane Stanley <[email protected]>

  • [AS][CS3] duplicate page items in a specific position on another doc

    Hello,
    I need to copy or duplicate page items of the active page of doc 1 in a specific position of the active page of doc 2.
    I can duplicate the page items of doc 1 into the doc 2 (with the code below) but can't find a way to duplicate them in a specific position: they are always duplicated in the same position on the active page of doc 2.
    The current working code (simplified) is:
    tell application "Adobe InDesign CS3"
    tell document 1
    tell layout window 1
    set pageitemlist to every page item of active page
    end tell
    end tell
    duplicate pageitemlist to the active page of layout window 1 of document 2
    end tell
    Thanks for your help!

    -- This works in CS4:
    tell application "Adobe InDesign CS4"
    tell document 1
    tell page 2
    set d to duplicate page item "textframe1" -- the text frame labeled "textframe1"
    -- FYI, d has a class of list:
    -- "text frame id 328 of page id 237 of spread id 232 of document "Untitled-2" of application "Adobe InDesign CS4""
    end tell
    move d to page 4 -- moves to 0,0 on pg4
    end tell
    end tell

  • [CS3 JS] Getting a page item by its script label

    I have a text frame on a master page with its script label set. In my script, I am trying to get a reference to the text frame with this:
    var doc = app.activeDocument;
    var spread = doc.masterSpreads[0];
    var tabFrame = spread.allPageItems.item("TabLeft");
    I get the error "spread.allPageItems.item is not a function"
    Any help will be appreciated. Thanks.
    Rick

    Hi Rick,
    spread.allPageItems returns a flattened array of all of the page items in the spread, at any level of the hierarchy (i.e., inside groups and other page items). Is that what you want? Sadly, allPageItems does not benefit from the special case where we use the label as a name, so you'll have to iterate if that's what you want.
    As Peter says (thanks, Peter!), spread.pageItems.item("label") gives you all of the page items whose label matches the string, but it does so in sort of a weird way--you'll always get a page item object. If no page items match, you get an invalid page item; if one matched, you get a single page item, and if multiple page items matched, you get a page item object that actually contains multiple page items. It can take a little testing to figure out exactly what it is that was returned.
    Thanks,
    Ole

  • [JS CS3] disappearing page items

    Now this is strange: I've written a script that does some imposition of a an image on a single sheet (page) and puts some special printers marks along the side. Now there's (as far as i am aware of) one instance where all the page items get placed on the page, but when you save, close and reopen the document, half of them are gone!
    When you drag the page items before saving they disappear right from under your cursor! I've tried putting a lot of save commands during the script, hoping that that would nail those items down, but with no luck.
    Has anybody had a similar experience and found a solution?
    Thanks,
    james

    Hi,
    You should send your script then we could have a try on our side.
    Loic

  • CS3: Rotated page item: How can I get the top-right point

    Hi
    I have a rotated page item. Now I should have the top-right and the bottom left point. If I get the rectangle of this page item I only have the top-left and the bottom-right point. And I can read the rotation angle.
    - How can I get the missing points?
    Thanks
    Hans

    Algorithmically speaking (ie, this is NOT real code), isn't it just something like:
    if page.rotationAngle == 90 then
    origTopLeft = (newBottomRight.Y, newTopLeft.X);
    else if page.rotationAngle == -90 then
    origTopLeft = (newTopLeft.Y, newBottomRight.X);
    else if page.rotationAngle == 180 then
    origTopLeft = newBottomRight;
    else
    origTopLeft = newTopLeft;

  • [CS3 Server] Page items copy problem

    I'm trying to copy page items from one document to other. I use kCopyCmdBoss command.
    Command processes successfully but extra pages are generated in destination document and InDesign fails after opening it.
    What could be a problem?
    Thanks in advance.

    -- This works in CS4:
    tell application "Adobe InDesign CS4"
    tell document 1
    tell page 2
    set d to duplicate page item "textframe1" -- the text frame labeled "textframe1"
    -- FYI, d has a class of list:
    -- "text frame id 328 of page id 237 of spread id 232 of document "Untitled-2" of application "Adobe InDesign CS4""
    end tell
    move d to page 4 -- moves to 0,0 on pg4
    end tell
    end tell

  • [CS3] Stroke Type of an page item?

    Hello!
    Does anybody know how to get the stroke type of an page item?
    There are so many possibilities.
    Thanks,
    Alois Blaimer

    Hello!<br /><br />I have found somenthing:<br /><br />          // Inspect dash.<br />          InterfacePtr<IDashedAttributeValues> dashedAttributeValues(static_cast<IDashedAttributeValues*>(descriptor->QueryAttribute(kDa shedAttributeValuesBoss, IDashedAttributeValues::kDefaultIID)));<br />          if (dashedAttributeValues != nil) {<br />               SNIPLOG(" dashedAttributeValues");<br />               for (int32 i = 0; i < dashedAttributeValues->NumValues(); i++) {<br />                    SNIPLOG("  [%d] %f", i, ::ToDouble(dashedAttributeValues->GetValue(i)));<br />               }<br />          }<br /><br />But the problem is, it always returns "12". I change the stroke style and it always returns "12".<br /><br />What's wrong with the code?<br /><br />Thanks,<br />Alois Blaimer

  • CS3/CS4 - Preview of page item = Crash in rare cases

    Hi,
    I'm wondering about how the to draw a preview of a page item, in the most correct way. Currently im using the SnapshotUtils like:
    SnapshotUtils ex(somePageItemRef,scaling,scaling);
    And then:
    AGMImageRecord* fpCurAGMImage = (AGMImageRecord*)ex.CreateAGMImageAccessor()->GetAGMImageRecord();
    to obtain an AGMImageRecord that I can draw onto an IGraphicsPort:
    PMMatrix theMatrix;    // No transform
    gPort->image(fpCurAGMImage, theMatrix, 0);
    However, one customer(PPC Mac 10.4 CS4) had a crash in this code, as seen from the partial stack trace below:
    Thread 0 Crashed:
    0   AdobeAGM                            0x01417418 AGMTerminate + 4143764
    1   AdobeAGM                            0x012b645c AGMTerminate + 2697944
    2   AdobeAGM                            0x012bc3e8 AGMTerminate + 2722404
    3   AdobeAGM                            0x012be210 AGMTerminate + 2730124
    4   AdobeAGM                            0x0120b8d4 AGMTerminate + 1998672
    5   AdobeAGM                            0x01030150 AGMTerminate + 51148
    6   ...adobe.InDesign.AppFramework      0x114f48c8 GetPlugIn + 118040
    7   ...adobe.InDesign.AppFramework      0x114f4b30 GetPlugIn + 118656
    8   com.adobe.InDesign.MyPlugin              0x0e405778
    MyCustomView::Draw (IViewPort*, __HIShape*) + 1560
    I can see in the documentation that the GetAGMImageRecord function should not be called any more as of InDesign 3.0, however I cannot figure out another way of obtaining an object that i can draw onto the IGraphicsPort? Is there a more preferred solution?
    I Hope somebody can help on this one
    Thanks!
    Kind regards Toke

    Hi Toke,
    I do not have any experience with this sort of stuff ;-(
    However have you noticed the sdk sample transparencyeffect which still uses GetAGMImageRecord even with CS4. Maybe the sample code sheds some light on your problem.
    Best,
    Peter Schülke

  • CS3 / Win: Observe copy/paste action of a page item

    Hi
    I like to observe the manual copy and paste of a page item.
    How can I do that?
    What do I have to attach to the observer?
    I get the action kAddToHierarchyCmdBoss and kNewPageItemCmdBoss when I copy and paste a page item. this works.
    Now the problem:
    In the text story of my page item there is a table. I can get the number of tables and the ITableModel of the text story in my application, thats not a problem. But I can't get the ITableModel in my observer (kAddToHierarchyCmdBoss ) if I paste the page item. The interface is always nil. I don't know why and I am looking for a solution.
    Maybe the text story is not finished when I get the kAddToHierarchyCmdBoss.
    Is it possible to observe if a text story is finished? I mean the copy of a text story is finished.
    Thanks a lot.
    Kind regard
    Hans

    I am checking in myDocObserver cmd->GetCommandState() == ICommand::kDone?

  • [CS3] How to get whether a UID is a spread, page, page item?

    Hello!
    I have an UID.
    How can I get whether behind the UID is a spread or a page or a page item?
    Alois Blaimer

    You can't.
    If you have a database for that UID though, you can use database->GetClass(myUID) ...
    Rather than dispatching on the class ID, you better identify your required interfaces on the boss. Instantiate them (again using db+id) and if those do not exist navigate around in IHierarchy or give up gracefully. Note there are some more boss classes and stranger arrangements than you initially know - master spreads, groups, standoff, inline items, multicolumn text and so forth.
    Dirk

  • How to get UIDRef of the selected page item in indesign cs3

    Hi,
        I want to get the UIDRef of the selected page item like Rectangle Frame. Can you show me the complete code snippet to get the UIDRef of selected Rectangle Frame. I need this UIDRef for getting the geometric bounds properties(width and height) of the selected rectangle frame to display the user in dialog box.
    Regards,
    K.Saravanan.

    Hi,
    UIDList selection;
    InterfacePtr<ISelectionManager> pSelectionManager(Utils<ISelectionUtils>()->GetActiveSelection(), ISelectionManager::kDefaultIID);
    if(pSelectionManager == nil){
    break;
    InterfacePtr<ILayoutTarget> pLayoutTarget(pSelectionManager->QueryConcreteSelectionBoss(kNewLayoutSelectionBoss), ILayoutTarget::kDefaultIID);
    if(pLayoutTarget == nil){
    break;
    selection = pLayoutTarget->GetUIDList(kDontStripStandoffs);
    Then, you can use this interface "IGeometry" to get information about spline size.
    InterfacePtr<IGeometry> pGeometry(selection.GetRef(i), IGeometry::kDefaultIID);
    if(pGeometry== nil){
    break;
    PMRect splineBounds = pGeometry->GetStrokeBoundingBox();
    PMReal width = splineBounds.Height();
    PMReal hight = splineBounds.Width();
    Regards,

  • Text wrap on Master Page items

    RE:  InDesign CS2 on Windows Vista
    Hello,
    I inserted a graphic on both of my master pages and applied a text wrap to them.  However, on my document pages, my text does not wrap around the graphics.  (In the Text Frame Options dialog box, the "Ignore Text Wrap" box is not checked.)  I know I can either override my master page items (and insert the graphic again) or control-shift-click on the graphic and force the text to wrap around it.  But that puts another link to the graphic in my document...and I'm trying to minimize the file size.
    Do you have any ideas on how to make the text wrap on the master pages work on the document pages?

    Text wrap on masters is not honored on live pages in CS2. It was added as feature in CS3.
    Bob

Maybe you are looking for