JS CS3 Page Item Dimensions

Hi there
I'd like to change the width & height of a rectangle by certain increment. This can be easily done by manipulating geometricBounds.
However when the rotationAngle is other than zero everything goes off the rails.
I tried experimenting with horizontal & verticalScale but these are only relative changes. They might be useful if I knew how to get the original H&W of the rotated object. Unfortunately none of the rectangle's properties seems to be of any use.
My other attempt was through the angle, bounding box and trigonometric hell. I was successful with flat lines. 2D rectangles proved to be too much of a challenge for me. And I still don't think this is the right approach anyway.
So the question is: Is there any way to get or change the values in H & W fields in InD's control panel via JavaScript?
Thanks for help
weller

Following is my attempt at writing a function for width and height. It appears to work on rotated and sheared objects. Can anyone tell me if I'm on the right track?
>function WidthAndHeight(myRectangle) // Returns an array [width,height]
]] var myRectangleTopLeft = myRectangle.resolve(AnchorPoint.topLeftAnchor, CoordinateSpaces.pasteboardCoordinates, true);
var myRectangleTopRight = myRectangle.resolve(AnchorPoint.topRightAnchor, CoordinateSpaces.pasteboardCoordinates, true);
var myRectangleBottomLeft = myRectangle.resolve(AnchorPoint.bottomLeftAnchor, CoordinateSpaces.pasteboardCoordinates, true);
var d1x = (myRectangleTopRight[0][0] - myRectangleTopLeft[0][0]);
var d1y = (myRectangleTopRight[0][1] - myRectangleTopLeft[0][1]);
var myWidth = hypotenuse(d1x,d1y);
var d2x = (myRectangleTopLeft[0][0] - myRectangleBottomLeft[0][0]);
var d2y = (myRectangleTopLeft[0][1] - myRectangleBottomLeft[0][1]);
var myHeight = hypotenuse(d2x,d2y);
return [myWidth,myHeight];
function hypotenuse(d1,d2)
]]]] d1 = Math.abs(d1);
d2 = Math.abs(d2);
return Math.sqrt ( Math.pow(d1,2) + Math.pow(d2,2) );

Similar Messages

  • Numeric Dimensions with Page Items

    If you have a numeric dimension such as a period number when you select the Page Item 'ALL' and it aggregates the rows it also aggregates any numeric dimension. Can you stop this other than changing the numeric dimension to a character object. ( this effects the sort sequence)

    You need to loop.
    Check out "Referencing Arrays,Referencing Values Within an On Submit Process" sections in following documentation.
    This should give you fair idea.
    http://download.oracle.com/docs/cd/E10513_01/doc/apirefs.310/e12855/apex_app.htm
    For example if you have report with following query
    SELECT APEX_ITEM.TEXT(1,column_name) FROM myTable;
    and if you have 10 rows in table, then 10 text items will display on your page.
    Since we have given the ID (p_idx) as 1, we can refer these text items using G_F01 global array. (If its 2 then G_F02 etc. we can have upto 50 dynamic item on one page)
    G_F01.COUNT gives us "number of items"
    G_F01(i) gives us value of i ^th^ text item value.
    Hope it helps
    Regards,
    Hari

  • [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]>

  • 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

  • [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

  • Verizon doesnt offer the upgrade after 1 year and 8 months anymore?!

    I've been with Verizon for a really long time and one of the best things about their upgrades was that they used to allow you to do it a little early.  And since you dont really keep up with plan changes until a new phone comes out or you are closer

  • Acro Reader No Longer Opens Media on Internet

    I have a website, www.vincentasl.info, long in operation, that provides access to PDFs containing embedded audio and video clips. It has worked successfully for years, but after a delay during which I did not confirm it operation, I recently noticed

  • Does the lightning to 30 pin adaptor work in speaker docks?

    My old 3rd Generation iPod stopped working (the round scrolling dial won't work), so I bought a new 7th generation iPod last week.  I realized I couldn't play it on my fairly low-end Memorex speaker dock, so I got one of those $30 lightning-to-30-pin

  • Button Layer Issue

    Hello, Having trouble figuring out what the correct actionscript for a button that is trying to access a labeled frame within a movie that is part of a larger movie. It works if I play it by itself outside of the larger movie, but I'm not sure how to

  • Family Sharing on iPad

    Hi this may seem like a silly question.  I've set up my 8 year old with her own apple id, and have activated family sharing.  do I now need to remove my Apple ID from her iPad for the "ask to buy" facility to work properly?  Ive tried a dummy purchas