How to make a rectangle around activeDocument.selection?

Hello world!

Recently, I met a terrible problem. I want to make a rectangle around the current selection, but not success.

Could you help me or give some clues? Thank you!

HAVE version?

In CS3 , it works for me:

// Box4selectedPath.jsx
// for selected pathItems   // CS3
// creates a green rectangle around all the selected paths (visibleBounds)
// regards pixxxelschubser

// http://forums.adobe.com/thread/1183584

var StrtPOrigin = app.activeDocument.pageOrigin;
var StrtROrigin = app.activeDocument.rulerOrigin;
app.activeDocument.pageOrigin = Array(0,0);
app.activeDocument.rulerOrigin = Array(0,0);

var aDoc = app.activeDocument;
var Sel = aDoc.selection;

var newRGBColor = new RGBColor();
newRGBColor.red = 0;
newRGBColor.green = 255;
newRGBColor.blue = 0;

if (Sel.length >0 ) {
    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 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]};
        }
    }

var aRectangle = aDoc.pathItems.rectangle(vBounds_Ob, vBounds_Li, vBounds_Re - vBounds_Li, vBounds_Ob - vBounds_Un);
aRectangle.strokeColor = newRGBColor;
aRectangle.strokeWidth= 2;
aRectangle.filled = false;
aRectangle.stroked = true;
aDoc.selection = null;

} else {
    alert ("no selection")
    }

app.activeDocument.pageOrigin = StrtPOrigin;
app.activeDocument.rulerOrigin = StrtROrigin;

Don't forget: only pathItems

Tags: Illustrator

Similar Questions

  • How to make the handles visible direct selection on the pasteboard?

    When I go to for transformation/resize images within frames using direct Selection, I don't see the handles of the image because they are white against a white cardboard.  I use InDesign CS5 (ver 7.0.4) on a Mac. I've been using InDesign for a few years and never noticed that it was a problem; all of a sudden, the handles seem invisble. I don't remember what the color scheme was before. (Maybe I'll lose my mind). The colors did not alter an update? There is an option in the preferences to choose the color of the pasteboard, but this does not seem to have any effect. In the meantime, I can't find the handles to resize/convert images. I can enter a percentage to scale, but it is sometimes useful. How to make the handles visible direct selection on the pasteboard?

    If you're talking about the color of a path and its handles, which is dependent on the color of the layer selection. Go to the layers panel. Double-click the currently selected schema and change the selection to something darker color.

  • TURN OFF Keyline rectangle around multiple selected items.

    When you select several items in Illustrator, I want to see only the highlighted items, not a rectangle keyline around the Group of selections.

    Note that these are free elements, not grouped.

    How to disable this option?

    View menu > hide the rectangle enclosing

  • How to make a glow around a person/object?

    I just want to have a glow behind someone.  I know that I could make a layer behind it, draw a line soft all around the object and then the blur, but y at - it an easier way?  Maybe something that could make an automatic outline of an object?  Thanks in advance.

    -TitanVex

    TitanVex,

    http://www.pixentral.com/show.php?picture=1XSChkSj88uk6oDO0SoLFrHVezOQ1

    1. Make your selection with one of the selection tools. I used the magic Extractor
    2. Place the selection on its own layer and make the selection active (CTRL + left click on the thumbnail of the layer) - should see the ants
    3. Go to layer > Layer Styles > Style settings
    4. Check the outer glow and set the parameters of the glow.
  • How to make tabs see the place selectively in different pages?

    Hello

    I'm new to APEX and get my hands dirty now...

    I have a standard set of tab called 'TS1', which has 2 tabs (say tab1 and tab2). Because the tabs are under "shared component", it seems that they are broadcast in all of 10 pages that I have.

    How can I make the tabs appear selectively on different pages? For example, I want tab1 and tab2 showing upwards to page1-9, but NOT on page10. There is a 'conditions' (Type of Condition), but it has many types and I do not know how to use it.

    Please kindly help!

    Thank you very much
    Helen

    Helen:

    Select "current page is contained in Expression... "for the Type of Condition
    and then enter the page numbers whose tab is to the field of "Expression".

    CITY

  • How to make a list of dynamic selection with time interval of 15 minutes

    Hi all

    I have a question. I need a selection list containing the time with 15 minute intervals from 08:00 until 16:00.
    example 08:00
    08:15
    08:30
    08:45
    09:00
    09:15
    and so on until 16:00
    Or values stored in a column of varchar type.
    Can someone help me with this one please?

    Best regards
    Caroline

    You can generate the entries in a dynamic way, as:

    select  to_char(trunc(sysdate)+8/24+(level-1)*1/96,'HH24:MI') period
    from    dual
    connect by level <= 33 
    

    or if you want/need to use your stored values:

    select display_column, return_value from table where
     display_column in (
                   select  to_char(trunc(sysdate)+8/24+(level-1)*1/96,'HH24:MI') period
                   from    dual
                   connect by level <= 33 )
    
  • How to make a thumbnail?

    How to make a tile around a business card using AI CS3?

    Thank you

    What would be wrong with a slat Patricia degraded, you can easily adjust the shape of the gradient to be oval and adjust the position of the size of the spread of the graadient as well as opcaity and mid point.

  • When I export my file to generate a .pdf file, the text box is literally a box around it! How to make this line disappear?

    When I export my file to generate a .pdf file, the text box is literally a box around it! How to make this line disappear?

    Looks like you have a line on it. Select the image and the race set to None.

  • How to select and deselect an existing path and how to make choices using?

    Hello

    I have created a path to the Master file.

    How to select and deselect this existing path and how to make the selection for the rest of the procedure?

    I talked about this script reference guide, I tried this: app.activeDocument.pathItems.getByName ("path of 1');

    But it does not work. Could you please help me on this?

    Thank you

    Rajiv.s

    I thank very you much for the help!

  • How to make a selectable TabAction at startup?

    Here is my code, can anyone tell me how to make a selectable TabAction

    var action1:Action = new Action ("About");
    Action1.actionBarPlacement = ActionPlacement.IN_OVERFLOW;

    var usageTab:TabAction = new TabAction (null);
    usageTab.label = "using";

    var detailsTab:TabAction = new TabAction (null);
    detailsTab.label = "Details";

    var settingstab:TabAction = new TabAction (null);
    Settingstab.label = "settings";

    ActionBar = new ActionBar();
    actionbar.showTabsFirstOnBar (true);

    actionbar.addAction (usageTab);
    actionbar.addAction (detailsTab);
    actionbar.addAction (settingstab);
    actionbar.addAction (action1);

    Thank you

    Dembélé

    I got the result

    actionbar.selectedTabAction = usageTab; Tab name

  • Hi, PDF form of the guru. How to make a text box become a required field IF a drop-down list is selected as the "Yes"?

    Hi, PDF form of the guru.

    How to make a text box becomes a "required field", IF a drop-down list is selected as the "Yes"?

    and 'not required' if the drop down menu selected as 'No' or left blank.

    Any help would be greatly appreciated

    see you soon

    Use this code in the custom drop-down list field validation script:

    this.getField("Text1").required = (event.value == "Yes");

    (Change "Text1" to the actual name of your text field, of course)

  • Simple question - how to make an onchange event occur in a select list

    Simple question - how to make an onchange event occur in a list to start a process of selection?
    Thank you

    (1) with the ApEx selection about to submit list.
    You create a PL/SQL process after Submit. -> Request for conditional Type = Expression1. -> Expression1 is the name of your selection list. Treat the Source - > procedure you like. For example based on your select list value you add rows in different tables.
    (2) Javascript this example will change a system parameter value when changed

  • How to make transparent psd files?

    How to make images transparent when psd I drag and drop the layer on the stage on flash cs6?

    For example an iv was do what he so far recorded as a psd and then go to the folder to import into the flash library. It's very very time consuming and would be a lot easyer if I can simply drag and drop the layer photoshop on the scene, but the problem is that the image gets a white box around it and that it is not transparent, when I do this.


    Is there an option in photoshop or flash to solve this problem and make the background transparent?

    Reminds me of Mario Bros. Yoshi

    I know what you want to do, but as the first answer mentioned, you can do it. Until Photoshop is updated to copy with transparency intact in the Windows Clipboard, you will not be able to do. The reason why I've linked and showed a screenshot of the GIMP is to prove that it is a limitation of Photoshop, not a limitation of Flash or the Windows Clipboard.

    Knowing this, it not there no way for you to copy/paste, drag/drop from Photoshop directly in Flash.

    Cartoon animation is essentially identical to the way most of the games work. You create one large master image that contains all the possible variations of your subject (a face, a car, etc.) and import that into a game. Do you the same thing during the animation, only you keep them all separate instead of a single image.

    Knowing that your experience with Flash is small and growing, I won't make the most optimal recommendation. I'll stick to 2 things that I've mentioned before, but elaborate on them.

    (1) save your assets on real png with transparency, then import them into Flash.

    The reason why I highly recommend this much is due to the function of update of the Flash (I'll explain) and it is possible to automate some (also will be explained).

    So, I grabbed a sheet of sprite in Yoshi and say that I did a new pose as you mentioned. In Photoshop I have then select and copy this new single pose, with transparency:

    As you know, once you do that you can bring up a "New Image" dialog box, and it will already have the size of your pixels copied (with adorned transparency):

    You can see the size is correct and the preset's Clipboard. After that, you just paste your new image in and clear the background to achieve transparency. Then save you it to a separate file. I always use save for Web to a pinch of optimization of size of files and general control:

    Yet once, I realize that it is much more that you want to do, but all of this can be automated which will be explained after virtually making a send operation button.

    Now we have the image as a separate new PNG image with transparency intact. This image should be imported into the Flash library:

    Now you have both a separate physical copy of this pose in a PNG file (which can be useful for many reasons) and Flash can use this file with it's built in control of update of the very rapid changes.

    Now say you touch up your a pose a bit. I'll make it really obvious and change the hue of all. You make your changes in Photoshop, follow the same process (even make changes to the original image size), possibly replacing the PNG you created for this installation:

    Now in Flash, all you need to do is use the update feature. Right-click on the image in your library, select update. Because it is a file with a physical location, that's all that is needed to change the image in Flash:

    The power in this is that if you make changes to dozens or hundreds of png, you can do this command in a single Flash. Select all modified images and press update and all your changes will be made at the time. You can't do this kind of things when you copy and paste directly into Flash.

    That said, almost all of the steps above can be automated using the Photoshops Actions Panel. No need to reinvent the wheel, Actions are explained here:

    http://help.Adobe.com/en_US/Photoshop/CS/using/WSfd1234e1c4b69f30ea53e41001031ab64-7448a.h tml

    I would recommend the Save action once you make your selection rectangle around what you want to save a PNG image. Save up to save for Web and stop there. Then in the future, you press the shortcut key that affect you and it will be part of your choice, open a new document, paste it in, turn off the background for transparency and you will bring to the dialog box in which you can name the image. It's pretty simple and automated. Then just import into Flash and enjoy the benefits.

    (2) use Photoshop to create assets, then another program to copy/paste in Flash

    Is not ideal to have 2 programs need, however if you really want you copy and paste directly into Flash, it is the way to go. Download any program that can read the PSD file format, open your PSD in there. If you have enough RAM this shouldn't really be a problem (PS and GIMP side by side, same open file):

    As you make changes to the PSD, just hit reload or go back in your program to support ' copy in transparency ', copy what you need, paste it into Flash:

    I'll explain some of the benefits of the previous workflow if you want, but I think that this is the overload of enough information for now.

  • How to make a 3D cube?

    How to make a 3D layout on Mac cube?

    Well, it can be done.

    Inventory

    1. rectangles, 2
    2. parallelograms, 4

    Exploded diagram:                                                                                                Completed:

    Individually, you may want to organize each shape selected and in the tab object, set dressing to zero. This will facilitate alignment object later.

    Insert a rectangle and duplicate by option + do swipe an offset as shown above. Duplicate this last rectangle with an option-drag that it will become your playdough for the first form of parallelogram. Select the third rectangle and then on the Format menu, choose shapes and lines: make it editable. To the four corners of the rectangle will have now taken red, which you can pull and push to get to the first form of parallelogram. Click outside the shape to dismiss the Red edit handles. When you have an approximate parallelogram shape, option + do slide once to do the opposite wall of the cube and then option-drag to another that will flip you (via the tab reorder), to make the top and then option-drag to reduce the shape of the bottom.

    At this point, you have the above exploded view. You don't have to worry when you drag the pieces together and they do not correspond exactly. Once more, you use the Format menu: shapes and lines: make editable to fine tune your editing of parallelogram in their locations next to the cube. When I did, I selected the content of all of the cube and applied 0.5 pt gray border lines, and each face of the cube is 38% opacity. Fill color for each face of the cube is optional.

  • How to make windows require a password during the installation of new programs?

    How to make windows require a password during the installation of new programs?

    Hello

    You will not be able to circumvent the password that appears before the execution of actions (installing a new program) in a non administrator account.  If you are logged on as administrator, and again, you get the command prompt, you can disable UAC (User Account Control) to stop the password dialog window.

    However, as a work around you can right-click on the installation of the program files and select run as administrator. Check if this is useful.

    Let me know if I can help you with this question or any problem related to Windows.

Maybe you are looking for