JS CS3 resize a group

Is it possible to resize a group?
I'm putting this script together that will allow a user to make a selection the script copies the selection and creates a new document to a set size. The selections them pasted into the doc and grouped. The example below the new doc is 80x80mm and when ID places the copy on the page the position is wrong position. I would like to be able to change the x and y to 0 and set the height and width of the group to 80mm.
Is this possible?
app.copy();
var myDocument = app.documents.add();
with(myDocument.documentPreferences){
    pageHeight = "80mm";
    pageWidth = "80mm";
myDocument.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.MILLIMETERS;
myDocument.viewPreferences.verticalMeasurementUnits = MeasurementUnits.MILLIMETERS;
myDocument.viewPreferences.rulerOrigin = RulerOrigin.PAGE_ORIGIN;
app.paste();
var myNewGroup = new Array;
for (i=0; i<app.selection.length; i++) {
    myNewGroup.push (app.selection[i]);
  var myGroup = app.activeDocument.groups.add(myNewGroup);
  $.write(myGroup.geometricBounds);

I think I worked it out.
myGroup.geometricBounds = [0,0,80,80];

Similar Messages

  • Flash CS3 - Resize HTML Window

    Ok, I will word this in a different way. I posted earlier and
    received no responses. So, I will post once again.
    I am trying to make sure that my Flash CS3 Html web page
    stays centered across various computer monitor
    platforms.
    I found this code in an earlier post and wondering if the
    code will work.
    self.moveTo(0,0);
    self.resizeTo(screen.availWidth,screen.availHeight);
    Also, how many on this forum are working in Flash CS3? I know
    it's quite different than Flash 8.
    Thanks,
    Franchelle

    I'm still not sure about exactly what it is that you want to
    do. In any case, let me explain the various options that you have
    to displaying your Flash movie in an HTML document.
    In the Publish Settings window, in the HTML tab, there are
    two settings that will effect how your movie displays itself. The
    first is titled "Dimensions" and has three options: Match Movie,
    Pixels, and, Percent. Match Movie will force your Flash movie to be
    presented in its original dimensions. Pixels will allow you to set
    an absolute size for the movie. Percent will set the movie's size
    to a percentage of the available HTML window space.
    The second option, "Scale", has four options: Default, No
    Border, Exact Fit, and, No scale. Default will show your movie
    scaled to fit the window, No Border will allow your movie to scale
    without regard to the original proportions. Exact Fit will scale
    the movie in proportion to its original size. No scale will keep
    your Flash movie at its original size and resize matte around the
    movie to fill the available space. Scale has no meaning unless you
    use either Pixels or Percent in the Dimensions option setting.
    If you want to fill the HTML window space, regardless of its
    size, then use Pixels for the Dimension option and set the values
    for the width and height to 100%. If you want your movie to fill
    the window and enlarge or reduce as needed, then choose Default for
    the Scale option. If you want your Flash movie to remain at its
    original size and the matte to fill the available space in the HTML
    window then choose No scale for the Scale option.
    There are two other options on the Publish Settings screen
    that seem as though they would be useful, but they are not. The
    first is the HTML alignment option. This can be set for Default,
    Left, Right, Top, or, Bottom. Most are meaningless. Any setting
    except Right will force the Flash movie to sit in the upper left
    corner of the HTML window if the Dimensions and Scale options are
    left to their defaults. Using the Right setting will force the
    Flash movie to the upper right corner of the HTML window.
    The second option is the Flash Alignment option. This option
    will position the Flash movie relative to matte. This option will
    only take effect if you choose Pixels or Percent in the Dimensions
    option and a Scale option of No scale.
    There are no settings in the Flash Publising Options, or
    anywhere else in Flash to set or change the size of the HTML
    window, or to position that window on the user's monitor screen.
    The size and location of the HTML window is controlled by the
    browser.
    You need to use Javascript control the browser window. This
    will only work if the end user has Javascript enabled. To position
    a browser window, you use the moveTo() function. A simple function
    to position a window might look like this:
    <script language="javascript">
    function centerWindow() {
    var thisWidth = window.outerWidth;
    var newX = (screen.width - thisWidth) /2;
    self.moveTo(newX,0);
    </script>
    window.outerWidth will return the width in pixels of the HTML
    window, including any chrome on the sides of the window.
    Screen.width will return the width of the user's screen.
    Self.moveTo(x,y) will move the current HTML window to pixel values
    in the parens.
    To change the size of the HTML window itself, you use the
    resizeTo() function. Here's a simple example:
    <script language="javascript">
    function maximizeWindow() {
    self.moveTo(0,0);
    self.resizeTo(screen.availWidth,screen.availHeight);
    </script>
    This example uses screen.availWidth instead of screen.width.
    Screen.width will return the full width of the user's screen,
    screen.availWidth will return the width minus any space occupied by
    widgets that will not give up their space.
    In order to completely fill the HTML window with your
    content, you will also need to reduce the size of the window's
    margins. You can use a simple CSS declaration in the head of the
    HTML document to achieve this:
    <style type="text/css">
    body {margin: 0px}
    </style>
    This will work for every browser, except Opera. Opera also
    pads the window object. So, you'll need to add this line to account
    for Opera users: padding: 0px.
    You can use a combination of all of these settings to size
    and position your Flash movie and the HTML window on your end
    user's screen as you like.

  • How to properly resize a group

    I have following problem:
    To fit a group properly into a pane I want to resize it. Currently, I use setScale.. . The size changes, however the bounds remain the same.
    What is the correct way to achieve that?
    import javafx.application.Application;
    import javafx.scene.Group;
    import javafx.scene.Scene;
    import javafx.scene.control.Button;
    import javafx.scene.control.TitledPane;
    import javafx.scene.layout.HBox;
    import javafx.scene.layout.StackPane;
    import javafx.scene.layout.VBox;
    import javafx.scene.paint.Color;
    import javafx.scene.shape.Circle;
    import javafx.stage.Stage;
    public class JavaFXApplication1 extends Application {
        @Override
        public void start(Stage primaryStage) {
            HBox root = new HBox();
            VBox left = new VBox();
            root.getChildren().add(left);
            //create a titled pane with the max width of 100
            TitledPane tp = new TitledPane();       
            tp.setPrefWidth(100);
         tp.setMaxWidth(100);
         tp.setText("Notification");
         tp.setCollapsible(false);
            left.getChildren().add(tp);
            StackPane stackPane = new StackPane();
         stackPane.setPrefHeight(180);
         stackPane.setPrefWidth(100);
         stackPane.setMaxWidth(100);
         tp.setContent(stackPane);
           //just a second node beneth the Titled Pane  
            root.getChildren().add(new Button("Test"));
           // now create a larger circle, scale it down
           // and add it to the stackpane within the titdled pane
           Group gnote = new Group();       
           Circle cleft = new Circle(100,Color.GOLDENROD);
           gnote.getChildren().add(cleft);
           gnote.setScaleX(0.5);
           gnote.setScaleY(0.5);             
           stackPane.getChildren().add(gnote);
            Scene scene = new Scene(root, 300, 250);       
            primaryStage.setTitle("Hello World!");
            primaryStage.setScene(scene);
            primaryStage.show();
        }Edited by: skauf on 17.01.2013 07:29

    Note to myself:
    Put the scaling group into another group. This was too obvious.

  • CS3 JS Add group into frame

    Hi
    In InDesign UI you can copy a group of frames and paste it into another frame.
    I'm trying to replicate the results via JS
    I tried this:
    x = app.activeDocument.rectangles.add();
    y = app.activeDocument.ovals.add();
    z = app.activeDocument.ovals.add();
    x.groups.add([y,z]);
    then this:
    x = app.activeDocument.rectangles.add();
    x.groups.add([app.activeDocument.ovals.add(),app.activeDocument.ovals.add()]);
    Both attempts ended up with "Invalid parameter" error message
    Then I tried this:
    x = app.activeDocument.rectangles.add();
    y = app.activeDocument.ovals.add();
    z = app.activeDocument.ovals.add();
    g = app.activeDocument.groups.add([y,z]);
    g.select();
    app.cut();
    x.select();
    app.pasteInto();
    It did the job without errors, but I'm affraid it will be unnecessary slow in real world deployment.
    Please, can anyone explain what I did wrong with my first two attempts?
    Thanks for help
    Weller

    Hi
    Having carried out more experiments I made this discovery:
    (assuming that "myObject is a rectangle")
    after running:
    myObject.rectangles.add();
    myObject.rectangles.add();
    myObject.rectangles.add();
    I ended up with a couple of rectangles inside of the "myObject" frame.
    But they were not grouped.
    Though this partly solves my problem, I'm aware that Indesign won't allow me to do this in UI. (That is, it's only a single object or a group that can be "pasted into"). Am I really in for a big problem if I use this method?

  • [JS] CS3 Help with groups needed

    Hi.
    I am formatting a page of text frames, and images, and trying to group the selected objects together.
    While formatting the pageI am gathering an array of variables:
    myGroupArray = new Array();
    myGroupCounter = 0;
    myGroupArray[myGroupCounter]="myTextFrame";
    myGroupCounter++;
    etc...
    when I am finished a section, I want to group the contents of the vaiable 'myGroupArray'
    I am using this line:
    myGroup = myDoc.groups.add(myGroupArray);
    but getting an error 'Invalid value for parameter 'groupitems' of event 'add'. Expected Array o...t received("myTextFrame","myCorrectPic","myPriceFrame","mtQtyFrame").
    Can someone help me on this?
    Cheers
    Roy

    (Without actually trying it in ID)
    myGroupArray[myGroupCounter]="myTextFrame";
    That adds a string to the array, not the frame. If "myTextFrame" is a variable pointing to a text frame, simply use
    myGroupArray[myGroupCounter]=myTextFrame;
    By the way, have you been programming in other languages in the past? I have, and used
    myGroupCounter++;
    as well until finding out that for arrays, this built-in array function works equally well:
    myGroupArray.push(myTextFrame);
    Types much faster, and if you need the number of elements, you can always use myGroupArray.length.

  • [CS3][JS] Create Group Prior to its Children

    Hi
    Is there a way to create group along with all members in one go?
    What I currently do is:
    myGroupMembers = [
    myBox01,
    myBox02,
    myBox03,
    myBox04
    myDoc.groups.add(MyGroupMembers)
    Obviously, InDesign has to create all group members first and let me stare
    at the partial screen updates as the script runs. This can take quite long
    for 500 item catalogue subsection.
    So I thought there must be a quicker way.
    So far I tried this:
    mySpecs = {
    myItem01: Rectangle{
    label: "01",
    // other properties
    myItem02: Rectangle{
    label: "02",
    // other properties
    myItem03: Rectangle{
    label: "03",
    // other properties
    myGroup = myDoc.groups.add(mySpecs);
    I based this on ScriptUI resource string. I didn't expect it to work (It
    doesn't indeed). I'm just wondering whether it's only syntax error or flawed
    idea.
    Can anuone help me please?
    Thanks
    Weller

    Change those curly brackets around your mySpecs definition to square brackets (thereby changing it from an object to an array) and I think it'll work.
    Dave

  • [JS] CS3 One radio group multiple colums

    Is there any way to split one radio group into multiple columns?
    For example:
    Paragraph Alignment: Left
    Right
    Center
    Justify
    I would like it to look like this:
    Paragraph Alignment: Left Center
    Right Justify

    > Would you know where documentation for ScriptUI would be?
    ESTK 3: Help > JavaScript Tools Guide
    ESTK 2: Help > SDK > JavaScript Tools Guide
    Peter

  • Swatches CS3 - Sorting and grouping possible?

    Hello,
    a simple question. Is it possible to sort or group swatches?
    If the answer is yes, how do I do it?
    Thanks,
    Matt

    You can select and drag them up and down the panel.
    k

  • CS3 - resizing artwork for printing

    Hi,
    I have designed a new label WAY to big. And now i need to resize it for a small sticker.
    I initially set the document to 1100px x 500px but need to go down to 5cm x 3.6cm.
    I have a different objects hanging outside the 1100 x 500 as i couldn't work out how to use the crop tool
    The scale tool only lets me scale by percentage.. and anyway i think the items hanging outside will stuff up the scaling.
    Any tips?
    thanks in advance

    cwuot,
    As long as you have vector artwork only, you may resize both ways without limits.
    1100/500 = 2.2, 500/3.6 ~ 1.39.
    In other words you are changing to another proportion. You will have to decide one dimension.
    In any case, there are multiple ways to resize artwork as desired, some to get to specific values or changes.
    One is to select everything (relevant, you may copy the final version only to a new layer) and
    set a value (including the unit) in the W or H box in the Transform palette, then Ctrl+Enter to retain proportions. That could be 5cm in the W box or 3.6 cm in the H box.
    Or (if/once you have the same unit) you may multiply or divide by some number in the W or H box in the Transform palette, then Ctrl+Enter to retain proportions.

  • [CS2/CS3] - Resizable dialog window

    Hello,     I would like to create resizable dialog window with only few widgets, please does anybody have some sample of resources, how to do it or some link ?  Thank you for all answers, marxin

    Could you please advise me where to place additional widgets like TreeView and so on ?
    Here is my resizable dialog resource with treeview on it:
    resource AI2DialogWidget (kSDKDefDialogResourceID + index_enUS)
        __FILE__,
        __LINE__,
        kAI2DialogWidgetID, // WidgetID
        kPMRsrcID_None, // RsrcID
        kBindAll, // Binding
        Frame(0,0,406,412) // Frame (l,t,r,b)
        kTrue,
        kTrue, // Visible, Enabled
        kFalse, // erase background
        kInterfacePaletteFill, // fill color
        kAI2DialogTitleKey, // Dialog name
            ErasablePrimaryResourcePanelWidget
                __FILE__,
                __LINE__,
                0,
                kPMRsrcID_None,
                kBindAll,
                Frame(0,0,290,400) // Frame
                kTrue,
                kTrue,
                kFalse, // Erase background
                kInterfacePaletteFill, // Erase to color
                    /* Tree view for tests! */
                    AI2SectionsTreeViewWidget
                        kAI2SectionsTreeViewWidgetID,
                        kPMRsrcID_None, // WidgetId, RsrcId
                        kBindAll,
                        Frame(0,0,289,399) // Frame
                        kTrue,
                        kTrue, // Visible, Enabled
                        kTrue, // EraseBeforeDraw
                        kInterfacePaletteFill, // InterfaceColor
                        kFalse, // Display root node
                        kTrue, // Use H Scroll bar
                        kTrue, // Use V scroll bar
                        20, // fVScrollButtonIncrement
                        20, // fVThumbScrollIncrement
                        20, // fHScrollButtonIncrement
                        20, // fHThumbScrollIncrement
                        2, // Items selectable, 0 = No Selection, 1 = Single Selection, 2 = Multiple Selection
                        kFalse, // Allow children from multiple parents to be selected
                        kFalse, // Allow discontiguous selection
            //<FREDDYWIDGETDEFLISTUS>
            DefaultButtonWidget
                kOKButtonWidgetID, // WidgetID
                kSysButtonPMRsrcId, // RsrcID
                kBindRight, // Binding
                Frame(309,14,389,34) // Frame (l,t,r,b)
                kTrue,
                kTrue, // Visible, Enabled
                kSDKDefOKButtonApplicationKey,  // Button text
            CancelButtonWidget
                kCancelButton_WidgetID, // WidgetID
                kSysButtonPMRsrcId, // RsrcID
                kBindRight, // Binding
                Frame(309,44,389,64) // Frame (l,t,r,b)
                kTrue,
                kTrue, // Visible, Enabled
                kSDKDefCancelButtonApplicationKey, // Button name
                kTrue,  // Change to Reset on option-click.
            //</FREDDYWIDGETDEFLISTUS>
            DialogOnlySizeBoxWidget
                kDialogWindowSizeBoxWidgetID,
                kSysWindowSizeBoxPMRsrcId,
                kBindRight | kBindBottom,
                Frame(389,394,407,412)
                kTrue,
                kTrue,
                kADBEIconSuiteButtonType,

  • Resizing the group tree width

    Hi,
    I was wondering , if there is a way to re-size the width for the group tree in DHTML viewer . When a report is rendered, and if it has a group , then there is a pan that's shown in the left side of the report . Is there a way to set the width of it like a parameter file or SDK , to make it 5% or some width that I want , rather than the default.
    Thanks in advance .

    Take a look at the setToolPanelWidth and setToolPanelWidthUnit methods from the CrystalReportViewer class.

  • How do I resize a group of Like Objects to have identical Height/Width

    I would like to do this while EDITTING the Panel not during run-time.

    > I would like to do this while EDITTING the Panel not during run-time.
    In LV7, you use the toolbar menu item to make items the same height,
    width, or a particular size via a dialog box.
    Greg McKaskle

  • Problem resizing group of objects

    I was trying to resize a grouping of simple objects and hit some sort of limit as to how small it would go. It would resize larger but not smaller than some seemingly arbitrary size. Did a cut&paste (with cmd-N) into Preview and then cut&paste back into Keynote. Now the grouping will go smaller in Keynote and also into Pages. Does anyone know what this size limit thing is and how to avoid it?

    It was a grouping of simple shapes; lines, ellipses, a few polygons, some fill here and there. That's it.

  • Grouping and resizing screen controls

    The manual says this:
    To group screen controls:
    1 Select the screen controls you want to group together.
    2 Choose Group from the workspace Action menu (or press Command-Option-G).
    The screen controls are grouped. Moving one of the grouped controls moves the
    others, and resizing one of the grouped controls resizes the others.
    However, when I try that and then try to resize a group, only the control that I'm resizing actually resizes. Can someone else try this and then point me to the stupid thing that I'm missing?
    yes, all the controls (9 sliders, 8 buttons, 8 knobs) are "merged" before "grouping"
    Thanks,
    Stewart

    Make sure that you do not run Firefox in full screen mode (press F11 or Fn + F11 to toggle; Mac: command+Shift+F).<br />
    If you are in full screen mode then hover the mouse to the top to make the Navigation Toolbar and Tab bar appear.<br />
    You can click the Maximize button at the top right to leave full screen mode or right click empty space on a toolbar and use "Exit Full Screen Mode" or press F11.<br />

  • JS CS3 copy, paste and transform

    I have a script that allows the user to select objects on a page (in this case text frames) and create a new page user defined and then paste the selection on the page and make it fit the page size.
    I'm having a slight problem where the text frames in the group are not showing the text (get text overflow) after the resize. If I comment out the myGroup.geometricBounds = [0,0,38,38]; line in the script below and manually resize the group to the document height and width (38,38) the text frames in the group are all ok.
    var myNewGroup = new Array;
    for (i=app.selection.length-1; i>=0; i--) {
    myNewGroup.push (app.selection[i]);
    var myGroup = app.activeDocument.groups.add(myNewGroup);
    myGroup.move(Array(0,0) )
    myGroup.geometricBounds = [0,0,38,38];
    If anyone has any suggetions it would be greatly appreciated.
    John.

    This seems to be working. I went with the transform() in the end. If anyone has a better way please let  me know.
    var myNewGroup = new Array;
         //make group
    for (i=app.selection.length-1; i>=0; i--) {
        myNewGroup.push (app.selection[i]);
      var myGroup = app.activeDocument.groups.add(myNewGroup);
      myGroup.move(Array(0,0) )
           //get size of group
      var mySelSize = myGroup.geometricBounds;
             //get size of document
        var myDocHSize = app.activeDocument.documentPreferences.pageHeight;
        var myDocWSize = app.activeDocument.documentPreferences.pageWidth;
             //get scale value
        var myScalH = myDocHSize/mySelSize[2];
        var myScalW = myDocWSize/mySelSize[3];
             //apply transform scale
        var myScaleMatrix = app.transformationMatrices.add({horizontalScaleFactor:myScalW, verticalScaleFactor:myScalH});
        myGroup.transform(CoordinateSpaces.pasteboardCoordinates,AnchorPoint.topLeftAnchor, myScaleMatrix);

Maybe you are looking for

  • How to configure network virtualization in SCVMM 2012 R2 with two host

    hi everyone... can you teach me how i configure networking in my infrastructure.. i am getting confuse that i have 2 phisical server, i don't know to set the netwokring in scvmm. Every best practice, i found in internet is using more than 2 physical

  • Server does not support: RFC 567456 see CVE-2009-3555

    I am running Win 7, with a Netgear wireless dongle (Wn111v2) via a BT HomeHub. Both with latest drivers. Apart from Auto updates from MS & Firefox, no other software newly loaded. Recently, Netgear starts with 113 Mbps, then rapidly drops to 1 Mbps.

  • Secure Video conferencing with the ability to record

    Hi, I am looking for a flash based secure video conferencing app which has the ability to record conferences. I need it to enable a series of helpdesk type sessions and would prefer to use Flash so that the users do not have long set-up times. Does a

  • Paste in Place = differing results

    Hi, Could someone explain to me why (usually when pasting on a different layer) Paste in Place sometimes pastes the objects in the far top left of the document instead of where you'd expect ie... in place?

  • Adobe Reader Licence Agreement Problems

    Having some problems accepting the agreement so I can view .PDF Files - which I unfortunately can't do at the moment. Everytime I load a document, or the program on it's own, I get this 'can't connect to internet explorer' page instead. So I have to