Resizing selected objects

Ok, so I am trying to write a script that resizes an object that is selected. I have two objects selected, the one on top is a group item, the one below it is a rectangle. I am trying to resize the rectangle to the size of the group item on top of it with a little margin around it. Here is what I have so far.
var design = app.activeDocument.selection[0];
     var top=design.visibleBounds[1]+5*2; 
     var left=design.visibleBounds[0]-5*2; 
     var width=design.visibleBounds[2]-design.visibleBounds[0]+10*2;
     var height=design.visibleBounds[1]-design.visibleBounds[3]+10*2;
var background = app.activeDocument.selection[1];
background.position = (top, left, width, height);
The problem is the last line there. I'm not sure how to manipulate the position/size of the selected object or if it is even possible I have searched for it and haven not found an answer. Thanks in advance!

position property expects an Array, with x and y values, in that order. As for the width and height properties, use them in separate statements
background.position = [left, top];
background.width = width;
background.height = height;

Similar Messages

  • Why does the corner widget go away if I resize an object?

    In Illustrator CC (V 17.1.0 (64-bit) running Windows 7 Home Premium, I find that if I have resized an object, I no longer get the Corners option or widget when I switch to the Direct Select Tool. For discussion, assume we are talking about a box with square corners. When a new box is drawn of any size, all corner functions work perfectly but if the box is resized in any way, I no longer get the widget and the Corners menu item is no longer present.
    Any suggestions?

    Maybe you should start closing message tabs after you read them. If you have so many open that your inbox gets pushed off the screen you obviously just keep opening tabs without closing old ones.
    To get out of your situation now right click one tab and select Close Other Tabs. Then use the x on the remaining tab to click we it.

  • Is it possible to move/resize individual objects in Compound Clipping Path in Illustrator?

    Hi,
    I have created a Compound Clipping Path in Adobe Illustrator, and wonder if there is a way of moving/resizing individual objects in this path that create the mask? At the moment when I try to change just one object it changes them all.
    Essentially I am try to make fine adjustments to the mask.
    Thanks in advance for any help,
    Nick

    Adobe updated masks in CS4, which has made to editing inidividual contents within masks more difficult, especially more complex masks (eg: nested)
    When you select a mask now you select the mask and the contents. 5 ways to help you select the elements within the mask:
    To get into the contents to edit them use the "Edit Contents" button (the 2nd one in the top left).
    Flip down your layers palette triangles, to try and make selections there
    Individually select items with the hollow arrow tool or group select tool, and hide them, then unhide to have the sum of the elements selected.
    Save back to CS3 and work in CS3 
    Isolation Mode (though that mode is preferred disabled by many users)
    Be careful as if you ever release a mask, this can entirely mess up your layeringorder on occasion, and undo won't help. Save before releasing a mask, sometimes you can undo, sometimes undo will not be abel to reconstruct you layer order.

  • Illustrator thinks I want to resize an object...

    Hi, so this is an issue that really annoys me and I'm not sure if there's a solution for it and/or if someone has complained about it.
    Basically, if I make a small shape, something about 50x80px and I try to grab the shape to move it to a different location, illustrator just assumes that I want to resize the object and acts as if I grabbed the corner points. I specifically try to click away form the resizing points and it still does it. Its really annoying because the only way I can grab the object is by zooming in and making sure the cursor is now a lot smaller than the shape to move the object. The problem with doing this is that by zooming it forces me to scroll with the object to the place I want to be.
    When this happens, my cursor doesn't change to the 'resizing' cursor... the one with the 2 small arrows pointing opposite directions. It stays as the regular cursor.
    I am using the Illustrator CC updated to the latest as of this date.

    Vhalor,
    I believe it is safest to hold Alt/Option when you use the Direct Selection Tool, to avoid the danger of dragging only some Anchor Points.
    I wonder whether it is time for the list.
    The following is a general list of things you may try when the issue is not in a specific file, and when it is not caused by issues with opening a file from external media, see below. You may have tried/done some of them already; 1) and 2) are the easy ones for temporary strangenesses, and 3) and 4) are specifically aimed at possibly corrupt preferences); 5) is a list in itself, and 6) is the last resort.
    If possible/applicable, you should save current artwork first, of course.
    1) Close down Illy and open again;
    2) Restart the computer (you may do that up to at least 5 times);
    3) Close down Illy and press Ctrl+Alt+Shift/Cmd+Option+Shift during startup (easy but irreversible);
    4) Move the folder (follow the link with that name) with Illy closed (more tedious but also more thorough and reversible);
    5) Look through and try out the relevant among the Other options (follow the link with that name, Item 7) is a list of usual suspects among other applications that may disturb and confuse Illy, Item 15) applies to CC, CS6, and maybe CS5);
    Even more seriously, you may:
    6) Uninstall (ticking the box to delete the preferences), run the Cleaner Tool (if you have CS3/CS4/CS5/CS6/CC), and reinstall.
    http://www.adobe.com/support/contact/cscleanertool.html

  • Resize an object (image) doesn't work?

    Hi
    I'm trying to resize an image, but nothing happens. I'm following the instructions in the Help page.
    Description:
    - Click the Select Object tool.
    - Selection handles appear when the pointer is over the image (so the image is not locked).
    - Click the image. A thicker selection border appears.
    - Drag a handle of the object.
    - The selection is changing size, but nothing happens with the image.
    Same thing with Shift-drag the handle (to retain the original aspect ratio), nothing happens with the image.
    What is wrong?
    Note:
    the image is also a link. Could it be that the selection that appears is for the link, and not for the image? If so, how can I select the image instead?
    I have tried to remove the image link (Select Object tool, right click the image, Properties, remove link), but the image could still not be resized.
    Software:
    Adobe Acrobat X Standard
    Windows 7 Pro

    I don't think there is an "object touchup tool".
    Adobes help for Adobe Acrobat X Standard says:
    Resize an object
    Click the object with the Select Object tool , or the tool used to create the object.
    Drag a handle of the object. Shift-drag the handle to retain the original aspect ratio.
    Link:
    http://help.adobe.com/en_US/acrobat/standard/using/WS58a04a822e3e50102bd615109794195ff-7c7 4.w.html
    But only the selection border is being resized, not the image.
    I'm beginning to believe there is a bug in the resizing function.

  • Resize an Object via javascript

    Resize an Object via javascript
    How do I...
    I want to select an object in my document, onscreen, (an image, or text) then run a script that will discern the object selected, and show a dialog box that will allow me to input a sizing percentage for that object (with anchor corner/center)(Press enter and object resizes).

    No they don't.
    Acrobat may be bundled with Creative Suite collections but the APIs has nothing in common other than the use of JavaScript. CS apps use the ExtendScript system, Acrobat has its own internal API and an SDK for inter-application control.
    PDF is an end-destination format - the page content is not designed to be edited, so while there are tools in the user interface to allow touchups and corrections to page objects those features are not available for automation. The JavaScript engine does not have access to the low-level document structure, it can only see markup (comments and form elements) and a limited range of document properties.
    bdmasha wrote:
    They are all part of a suite of tools that share a common access to internal api's via scripting/programming languages.
    InDesign is not Photoshop is not Illustrator, but they have much in common when accessing their api's that Acrobat does not allow--and Acrobat is part of that Adobe suite.
    Thanks again.

  • Service template problem - Unable to perform the job because one or more of the selected objects are locked by another job - ID 2606

    Hello,
    I’ve finally managed to deploy my first guest cluster with a shared VHDX using a service template. 
    So, I now want to try and update my service template.  However, whenever I try to do anything with it, in the services section, I receive the error:
    Unable to perform the job because one or more of the selected objects are locked by another job.  To find out which job is locking the object, in the jobs view, group by status, and find the running or cancelling job for the object.  ID 2606
    Well I tried that and there doesn’t seem to be a job locking the object.  Both the cluster nodes appear to be up and running, and I can’t see a problem with it at all.  I tried running the following query in SQL:
    SELECT * FROM [VirtualManagerDB].[dbo].[tbl_VMM_Lock] where TaskID='Task_GUID'
    but all this gives me is an error that says - conversion failed when converting from a character string to uniqueidentifier msg 8169, level 16, State 2, Line 1
    I'm no SQL expert as you can probably tell, but I'd prefer not to deploy another service template in case this issue occurs again.
    Can anyone help?

    No one else had this?

  • Unable to remove a host from VMM - Error (2606) Unable to perform the job because one or more of the selected objects are locked by another job.

    I am unable to remove a host from my Virtual Machine Manager 2012 R2. I receive the following error:
    Error (2606)
    Unable to perform the job because one or more of the selected objects are locked by another job.
    Recommended Action
    To find out which job is locking the object, in the Jobs view, group by Status, and find the running or canceling job for the object. When the job is complete, try again.
    I have already tried running the following command in SQL Server Management Studio
    SELECT * FROM [VirtualManagerDB].[dbo].[tbl_VMM_Lock] where TaskID='Task_GUID'
    I received this error back:
    Msg 8169, Level 16, State 2, Line 1
    Conversion failed when converting from a character string to uniqueidentifier.
    I have also tried rebooting both the host and the Virtual Machine Manager Server.  After rebooting them both, I still receive the same error when trying to remove the host.
    Here are my server details
    VMM Server OS = Windows 2012 Standard
    VMM Version = 2012 R2 3.2.7510.0
    Host OS = Windows 2012 R2 Datacenter
    Host Agent Version = 3.2.75.10.0
    SQL Server OS = Windows 2012 Datacenter
    SQL Version = 2012 SP 1 (11.0.3000.0)

    Hi there,
    How many hosts are you managing with your VMM server?
    The locking job might be the background host refresher job. Did you see any jobs in the jobs view, when the host removal job failed?
    If there is no active jobs in the jobs view when this host removal job fails, can you please turn on the VMM tracing, retry the host removal, and paste back the traces for the failed job (search for exception and paste the whole stack)?
    Thanks!
    Cheng

  • Script to apply a random CMYK swatches from a group of swatches to selected objects.

    I would like to write some scripts for randomising the allocation of swatches to adjacent object.
    Example:
    Imagine a map of Europe and all her nation states/territories. I have a User Defined Swatch Library. I can open the AI document it was made from as I understand from this thread that having the swatches as objects on the page makes them easier to be referenced in a script. 
    I want to iterate through the selected objects and randomly assign one of the colours in the swatch document as a fill to each object. It would be great if hidden swatches (they are all small rectangular 'colour chip' filled paths) on page were not included in the reference swatches randomly choosen from.
    Iterating the selected objects I can do, but not sure what references I need to use to create an array of swatches to randomly choose from.
    I see I can make an array of swatches using the general swatch group from Adobe's CreateSwatchGroup scripts:
    JS
    var docRef = app.documents.add(DocumentColorSpace.CMYK)
    // Create a new SwatchGroup
    var swatchGroup = docRef.swatchGroups.add();
    swatchGroup.name = "CreateSwatchGroup";
    // Get list of swatches in general swatch group
    var genSwatchGroup = docRef.swatchGroups[0];
    // Collect 5 random swatches from general swatch group and move to new group
    var i = 0;
    while (i < 5) {
              var swatches = genSwatchGroup.getAllSwatches();
              swatchCount = swatches.length;
              var swatchIndex = Math.round(Math.random() * (swatchCount - 1)); // 0-based index
              // New swatch group does not allow patterns or gradients
              if (swatches[swatchIndex].color.typename != "PatternColor" && swatches[swatchIndex].color.typename != "GradientColor") {
                        swatchGroup.addSwatch(swatches[swatchIndex]);
                        i++;
    // Updates swatch list with swatches moved to new swatch group
    swatches = swatchGroup.getAllSwatches();
    // [… etc etc]
    AS
    tell application "Adobe Illustrator"
    activate
              set docRef to make new document with properties {color space:CMYK}
    -- Create a new SwatchGroup
              set swatchGroupRef to make new swatchgroup in current document with properties {name:"CreateSwatchGroup"}
    -- Get list of swatches in general swatch group
              set genSwatchGroup to swatchgroup 1 of docRef
    -- Collect 5 random swatches from the general swatch group and move to new group
              set i to 0
              repeat until i is 5
                        set swatchesRef to get all swatches genSwatchGroup
                        set swatchCount to count every item in swatchesRef
                        set swatchIndex to random number from 1 to swatchCount
                        set currentSwatch to item swatchIndex of swatchesRef
      -- New swatch group does not allow patterns or gradients
                        if class of color of currentSwatch is not pattern color info and class of color of currentSwatch is not gradient color info then
      add swatch swatchGroupRef swatch currentSwatch
                                  set i to i + 1
                        end if
              end repeat
    -- [… etc etc]
    If someone can help me to create the Swatch Array object of swatches loaded from a seperate document (or unique layer) then I think I can work my way to changing the fill on the existing paths (the nations in my map of Europe example).
    Would be very cool if I could detect neighbooring paths (nieghbooring nations in my map of Europe example) make sure the colour being assigned is not within a certain hue/CMYK range of the random colour and if it is rechoose random colour. I have no idea how to perform the logic of determining neighbooring paths in an Illustartor script. Anybody?!
    I'd prefer Applescript for sake of readiblity and also I'm learning AS ATM. Plus I'm using Script Debugger.app (which is excellent) to work with AS and I can't seem to run JSX scripts from within Extend Script Toolkit 2 (perhaps I need to make my scripts point to Illustrator?)
    But Javascript is okay if someone has this covered already :-)

    I would like to write some scripts for randomising the allocation of swatches to adjacent object.
    Example:
    Imagine a map of Europe and all her nation states/territories. I have a User Defined Swatch Library. I can open the AI document it was made from as I understand from this thread that having the swatches as objects on the page makes them easier to be referenced in a script. 
    I want to iterate through the selected objects and randomly assign one of the colours in the swatch document as a fill to each object. It would be great if hidden swatches (they are all small rectangular 'colour chip' filled paths) on page were not included in the reference swatches randomly choosen from.
    Iterating the selected objects I can do, but not sure what references I need to use to create an array of swatches to randomly choose from.
    I see I can make an array of swatches using the general swatch group from Adobe's CreateSwatchGroup scripts:
    JS
    var docRef = app.documents.add(DocumentColorSpace.CMYK)
    // Create a new SwatchGroup
    var swatchGroup = docRef.swatchGroups.add();
    swatchGroup.name = "CreateSwatchGroup";
    // Get list of swatches in general swatch group
    var genSwatchGroup = docRef.swatchGroups[0];
    // Collect 5 random swatches from general swatch group and move to new group
    var i = 0;
    while (i < 5) {
              var swatches = genSwatchGroup.getAllSwatches();
              swatchCount = swatches.length;
              var swatchIndex = Math.round(Math.random() * (swatchCount - 1)); // 0-based index
              // New swatch group does not allow patterns or gradients
              if (swatches[swatchIndex].color.typename != "PatternColor" && swatches[swatchIndex].color.typename != "GradientColor") {
                        swatchGroup.addSwatch(swatches[swatchIndex]);
                        i++;
    // Updates swatch list with swatches moved to new swatch group
    swatches = swatchGroup.getAllSwatches();
    // [… etc etc]
    AS
    tell application "Adobe Illustrator"
    activate
              set docRef to make new document with properties {color space:CMYK}
    -- Create a new SwatchGroup
              set swatchGroupRef to make new swatchgroup in current document with properties {name:"CreateSwatchGroup"}
    -- Get list of swatches in general swatch group
              set genSwatchGroup to swatchgroup 1 of docRef
    -- Collect 5 random swatches from the general swatch group and move to new group
              set i to 0
              repeat until i is 5
                        set swatchesRef to get all swatches genSwatchGroup
                        set swatchCount to count every item in swatchesRef
                        set swatchIndex to random number from 1 to swatchCount
                        set currentSwatch to item swatchIndex of swatchesRef
      -- New swatch group does not allow patterns or gradients
                        if class of color of currentSwatch is not pattern color info and class of color of currentSwatch is not gradient color info then
      add swatch swatchGroupRef swatch currentSwatch
                                  set i to i + 1
                        end if
              end repeat
    -- [… etc etc]
    If someone can help me to create the Swatch Array object of swatches loaded from a seperate document (or unique layer) then I think I can work my way to changing the fill on the existing paths (the nations in my map of Europe example).
    Would be very cool if I could detect neighbooring paths (nieghbooring nations in my map of Europe example) make sure the colour being assigned is not within a certain hue/CMYK range of the random colour and if it is rechoose random colour. I have no idea how to perform the logic of determining neighbooring paths in an Illustartor script. Anybody?!
    I'd prefer Applescript for sake of readiblity and also I'm learning AS ATM. Plus I'm using Script Debugger.app (which is excellent) to work with AS and I can't seem to run JSX scripts from within Extend Script Toolkit 2 (perhaps I need to make my scripts point to Illustrator?)
    But Javascript is okay if someone has this covered already :-)

  • Indesign CS3: How to get the UID of the selected object?

    Hello,
    How can I get the UID of the selected object in an document?
    Thanks,
    Alois Blaimer

    Hello!
    I do not get it. Please give me some more hints.
    I only want to know if the selected object is a square and then the UID of the selected square.
    Thanks,
    Alois Blaimer

  • Querying for a script insert multiple selected objects...

    Is there a script or plugin which insert multiple selected objects in one new text frame with one click?
    And is there a script or plugin which extract the content of anchored text frame out it's frame and replace it with it's frame. and extract selected text and insert it inside a new anchored text frame in it's place? (like convert text to table - convert table to text, but instead table we use text frame)

    Hi,
    Using OMB scripting to set attribute properties in a data mapping sort of defeats the purpose of utilizing a graphical user interface to define and set properties for a data mapping? Surely the GUI data mapping tool was created to get away from writing scripts and scripting would also require that you know the name of the data mapping, table operator and the set of attribute names for which you have to write one line of script to set each property value, i.e. 90 lines to set 90 attribute values.
    Cheers,
    Phil

  • Select Object Tool Adobe Pro 9.0

    Can someone please help me. My "Select Object Tool" under Tools, Advance Editing is greyed out. Does any one know how to activate it?
    Thank you in advance
    [email protected]

    Are there any security settings on the document?

  • Create a new object that surrounds the selected objects

    Is there anyway in illustrator to create a new vector object from selected objects?
    IE if i have three rectangles selected, can I make a new vector path that surrounds them all.
    I dont mean welding a group of vectors together or offsetting a path...which isnt exactly what i need.
    What Im needing to do is create cut lines around complex vector art quickly.
    Thanks in advance.

    Mike i need to make an outline around a logo but if the logo has many elements that make up the edge of the logo does that method work?
    As the cut line needs to be a closed path
    Ideally i want to avoid tracing around the logo with the pen tool or add to shape area in pathfinder tab.
    I sure theres a really easy way to do this.
    Kurt its an interesting discussion however in need a closed path to surrond artwork and live paint does just the opposite :)

  • [CS2] [JS] Resize anchored object...

    Good morning:
    I need help figuring out how to resize different objects that are anchored in text. They do have a script label on them.
    For example I have an inline text box with the script label "gadget" that needs to be resized from 1 inch to 2 inches.
    Is there away to do this by way of a script?
    Thanks in advance!
    Theresa

    Hi Teresa,
    This is a very basic example: it adds 1 inch to the width and height of the inline text frame with "gadget" label (I assume that it may occur only once in each story and measurements are set to inches). I wrote this on CS3 — don't have CS2 any more.
    var myDoc = app.activeDocument;
    var myStories = myDoc.stories;
    for (i = 0; i < myStories.length; i++) {
        var myTextFrame = myStories[i].textFrames.item("gadget");
            if (myTextFrame != null) {
            var myGb = myTextFrame.geometricBounds;
            var myNewGb = [myGb[0], myGb[1], myGb[2]+1, myGb[3]+1];
            myTextFrame.geometricBounds = myNewGb;
    Kasyan

  • Script to align selected objects to artboard

    Hello, I was wondering if anyone had a simple solution to aligning selected items to the artboard. I was going to create an action but then realized it would be more convenient for me to include it in my script file....I have a script to align objects with each other but they dont align to the artboard. Any suggestions?

    Hello volocitygraphics,
    here is a quick&dirty solution.
    Note that the result may be different, if clipping masks are exists in the document.
    Please test it at first on copies of your documents. Use it on your own risk.
    // ArtboardCenterAroundSelectedPaths.jsx
    // works with CS5
    // http://forums.adobe.com/thread/1336506?tstart=0
    // (title: script to align selected objects to artboard)
    // quick & dirty, all selected items will be centered at the active artboard 
    // (include clipping paths  !visible result can be different)
    // regards pixxxelschubser  19.Nov. 2013
    var aDoc = app.activeDocument;
    var Sel = aDoc.selection;
    if (Sel.length >0 ) {
        var abIdx = aDoc.artboards.getActiveArtboardIndex();
        var actAbBds = aDoc.artboards[abIdx].artboardRect;
        var vBounds = Sel[0].visibleBounds;
        vBounds_Li = vBounds[0];
        vBounds_Ob = vBounds[1];
        vBounds_Re = vBounds[2];
        vBounds_Un = vBounds[3];
    if (Sel.length >1 ) {   
        for (i=1; i<Sel.length ; i++) {
            vBdsI = Sel[i].visibleBounds;
            if( vBounds_Li > vBdsI[0] ) {vBounds_Li = vBdsI[0]};
            if( vBounds_Ob < vBdsI[1] ) {vBounds_Ob = vBdsI[1]};
            if( vBounds_Re < vBdsI[2] ) {vBounds_Re = vBdsI[2]};
            if( vBounds_Un > vBdsI[3] ) {vBounds_Un = vBdsI[3]};
        aDoc.artboards[abIdx].artboardRect = [vBounds_Li +((vBounds_Re - vBounds_Li)/2-(actAbBds[2]-actAbBds[0])/2), vBounds_Ob -((vBounds_Ob - vBounds_Un)/2+(actAbBds[3]-actAbBds[1])/2), vBounds_Li +((vBounds_Re - vBounds_Li)/2-(actAbBds[2]-actAbBds[0])/2)+(actAbBds[2]-actAbBds[0]), vBounds_Ob -((vBounds_Ob - vBounds_Un)/2+(actAbBds[3]-actAbBds[1])/2)+(actAbBds[3]-actAbBds[1])];
        } else {
            alert ("No selection");
    I hope so, the document coordinatesystem is the same as in CS6+
    Have fun

Maybe you are looking for