Selecting tools via scripts

Hello personal greetings to all:

Is it possible to select tools through scripting? I need to add the command a few buttons on a panel of HTML5. I tried to create action items for each of them, but some of them does not shares:

They are:

• The tool pen

• The free pen tool

• Add Anchor Point tool

• Delete Anchor Point tool

--------------------------------------------

• The marquee tool

• Elliptical selection tool

---------------------------------------------

• The polygonal Lasso tool

• The magnetic Lasso tool

01.png

I hope that these help...

/////// Pentool
var desc = new ActionDescriptor();
var ref = new ActionReference();
ref.putClass( app.stringIDToTypeID('penTool') );
desc.putReference( app.charIDToTypeID('null'), ref );
executeAction( app.charIDToTypeID('slct'), desc, DialogModes.NO );
////////freeform pentool
var desc = new ActionDescriptor();
var ref = new ActionReference();
ref.putClass( app.stringIDToTypeID('freeformPenTool') );
desc.putReference( app.charIDToTypeID('null'), ref );
executeAction( app.charIDToTypeID('slct'), desc, DialogModes.NO );
//////////Add anchor point tool
var desc = new ActionDescriptor();
var ref = new ActionReference();
ref.putClass( app.stringIDToTypeID('addKnotTool') );
desc.putReference( app.charIDToTypeID('null'), ref );
executeAction( app.charIDToTypeID('slct'), desc, DialogModes.NO );
//////////Delete anchor point tool
var desc = new ActionDescriptor();
var ref = new ActionReference();
ref.putClass( app.stringIDToTypeID('deleteKnotTool') );
desc.putReference( app.charIDToTypeID('null'), ref );
executeAction( app.charIDToTypeID('slct'), desc, DialogModes.NO );
//////////rectangular marquee tool
var desc = new ActionDescriptor();
var ref = new ActionReference();
ref.putClass( app.stringIDToTypeID('marqueeRectTool') );
desc.putReference( app.charIDToTypeID('null'), ref );
executeAction( app.charIDToTypeID('slct'), desc, DialogModes.NO );
//////////Elliptical Marquee Tool
var desc = new ActionDescriptor();
var ref = new ActionReference();
ref.putClass( app.stringIDToTypeID('marqueeEllipTool') );
desc.putReference( app.charIDToTypeID('null'), ref );
executeAction( app.charIDToTypeID('slct'), desc, DialogModes.NO );
//////////Polygonal Lasso Tool
var desc = new ActionDescriptor();
var ref = new ActionReference();
ref.putClass( app.stringIDToTypeID('polySelTool') );
desc.putReference( app.charIDToTypeID('null'), ref );
executeAction( app.charIDToTypeID('slct'), desc, DialogModes.NO );
//////////Magnetic Lasso Tool
var desc = new ActionDescriptor();
var ref = new ActionReference();
ref.putClass( app.stringIDToTypeID('magneticLassoTool') );
desc.putReference( app.charIDToTypeID('null'), ref );
executeAction( app.charIDToTypeID('slct'), desc, DialogModes.NO );

Tags: Photoshop

Similar Questions

  • Is it possible to get the name of the tool selected from a script?

    Hello

    Is it possible to get the name of the tool currently selected from a script?

    I found this:

    https://forums.adobe.com/thread/579195

    https://forums.adobe.com/thread/2161923

    But these works in Photoshop... So, it is possible to get the name of the tool currently selected in InDesign? Is there a universal method that will work in other applications?

    I think that there is a toolBoxTools, app.toolBoxTools...

    P.

  • Selection tool is not the tail with images when you drag

    So I had this frustrating thing for a while. When I put my selection tool a video file at first to move to the side or another layer and as soon as, like moving the selection tool a bit, he places automatically the video one layer under my selection tool... So I have to move the selection up to a length of layers tool to adjust it to the left and right on the timeline... Just a fight. I wish that the selection tool has not changed the layer of videos when I moved it left and right... Just stick with the images that I am setting on the im adjustment layer. Check out the video and you will understand what im getting. The selection tool shows a strange looking symbol with an arrow pointing down so I guess it's just a special feature that was accidentally checked the. You just don't know where I can go back to normal. Thank you

    Video:

    Went on the Chat with Adobe and they solved the problem via remote access.

    First on erase my personalized workspaces closed first pro. Then went to my "documents" (I have a mac) 'Adobe' and then click 'Premiere Pro' and moved three files named "6.0" "9.0" and "10.0" in a new folder, that they named "Od." Finally they opened back first. When the box came to put everything in place, they went up to the top of the window and deselected "import the project workspace" under "workspaces". I have opened a project and it fixed the problem. I had to make a new workspace and change some shortcuts custom back, but other that that, it was back to normal.

  • You can determine if a TextLayer is a Vertical or Horizontal via script?

    Hi all

    I did a little digging around and could not find if there was a way to determine if a TextLayer object was created with the Horizontal Type tool or the Vertical Type via script?  Also, it would be something that could be changed by program?

    Thank you!

    Calvin

    I'm not aware of any way to get directly to this attribute. You could probably deduce the State with sourceRectAtTime(), but I don't know any way to set/change.

    Dan

  • I would like to cut out an object using the Quick Selection tool and drop the object into another image. Can anyone help

    I use background images and want to cut objects of other JPEG files using the Quick Selection tool and drop them in the background image. So if I have a banana and select the object, I need to copy the banana in the context on the other.

    Hope it makes sense.

    Gary

    Select the banana. Right click > copy layer. Move tool. Click and drag to the other file. Place on the image.

    GOLD: load history and banana in a stack (file > Scripts > load file in the stack). Select banana and layer for copy or create the layer mask.

    Benjamin

  • Hello I am a student and I have a problem with the tool Selection (V). When I opened the file AI CC with CS6 selection tool doesn't allow me to change the selection. What can I do? (I have reinstall AI CC and the problem persists)

    Hello I am a student and I have a problem with the tool Selection (V). When I opened the file AI CC with CS6 selection tool doesn't allow me to change the selection. What can I do? (I have reinstall AI CC and the problem persists)

    Ivan,

    If it's on the rectangular objects, you may have encountered the bug Rectangle Live which is limited to the MAC versions from 10.7 and 10.8, but not of 10.9 (Mavericks) or 10.10 (Yosemite). If all goes well, the bug will be fixed soon.

    Thus, a switch for the Mavericks or Yosemite with a reinstall might be the way to solve it here and now.

    To get around it, in each case, it is possible to develop direct Rectangles to get the normal old shaped rectangles or Pathfinder > unit, or use the scale tool or the free transform tool.

    A more permanent way round that is to create normal old shaped rectangles, after running the free script created by Pawel, see this thread with download link:

    https://forums.Adobe.com/thread/1587587

  • Cannot select Tools or settings in CS6

    I just installed InDesign CS6 via creative cloud and I'm having a problem with the selection tools. With the character Panel, for example when I select the text in my document and go in the character Panel, InDesign will not let me select any other font, select the drop down menu, or change the font settings (size, location, etc.). If I'm in a text box, I can not select the direct Selection tool. I tried a new document and an old document with no luck. Any advice? Thank you!

    Windows? See the signs and tools InDesign respond not to the clicks of the mouse (Windows 7/Vista)

  • Modes of draw adjustment via script?

    Is there a way of setting of the draw via a script?

    I can't find any info.

    What I would like is to set the mode to draw to paint indoors for a selected path via a script instead of double click on the toolbar button or press SHIFT + D twice.

    Hi here, present two objects of sample clips. Let me know if you need to 'draw' more than one inside.

    Select two objects (the mask on top) before running the script.

    #target Illustrator
    
    //  script.name = drawInsideViaClippingMask.jsx;
    //  script.description = makes a clipping mask, retaining fill/stroke, to simulate "draw inside";
    //  script.required = two paths selected, top most path is the clipping mask;
    //  script.parent = carlos canto // 8/16/11;
    //  script.elegant = false;
    
    if (app.documents.length > 0)
        {
            var idoc = app.activeDocument; // get active document;
            var sel = idoc.selection; // get selection
    
            if (sel.length==2) // continue only if 2 objects are selected
                {
                    var igroup = idoc.groupItems.add(); // add a group that will be the clipping mask group
    
                    var imask = sel[0]; // the mask is the object on top
                    var ipath = sel[1]; // the "drawn object" is at the bottom
    
                    var idup = imask.duplicate(); // duplicate the mask, to later get the fill and stroke to apply to the clipping path
    
                    ipath.move(igroup, ElementPlacement.PLACEATBEGINNING); // add both path to the group
                    imask.move (igroup, ElementPlacement.PLACEATBEGINNING);
    
                    imask.clipping = true; // make the mask the clipping path
                    igroup.clipped = true; // clip the everything in the group to the clipping mask
    
                    imask.fillColor = idup.fillColor; // add fill color, same as the dup
                    imask.stroked = true; // stroke the mask
                    imask.strokeWidth = idup.strokeWidth; // add stroke width, same as the dup
                    imask.strokeColor = idup.strokeColor; // add stroke color, seme as the dup
    
                    idup.remove(); // remove the duplicate
                }
            else // show this message if other than 2 objects are selected
                {
                    alert("Select both, the Mask and the object that needs to be 'inside'.\rThe Mask needs to be the top most object.");
                }
         }
     else
        {
            alert ("there are no open documents");
        }
    
  • [CS] [JS] Selection tool

    Hello

    Can I change my current selection to tool Selection thro' JavaScript?

    do you understand my Question? I placed the cursor in the textframe of the document. When I run the script, I have to select the selection tool.

    Please suggest me.

    Concerning

    Kumar

    It works on CS3:

    app.menuActions.item ("$ID/selection Tool") .invoke ();

  • I'm trying to select several images (Forms), but I have not found a selection tool. This selection tool to transform the mouse cursor in an arrow and it is possible to select several images or figures. I use Microsoft Excel for Mac 2011 Version 14.5.3.

    I'm trying to select several images (Forms), but I have not found a selection tool. This selection tool to transform the mouse cursor in an arrow and it is possible to select several images or figures. I use Microsoft Excel for Mac 2011 Version 14.5.3. Thank you!

    tupensi wrote:

    use Microsoft Excel for Mac 2011 Version 14.5.3. Thank you!

    Then you should post on the Microsoft Mac forums where to hang out the gurus of the Office, as is the Microsoft product, with that you are having problems:

    http://answers.Microsoft.com/en-us/Mac

  • get palette via script items

    Is it possible to access the control palette and its sub-sub-pallets/controls within these secondary pallets via script? I'd like to get the channels of available items

    so... theres a range reading vi. Who would have thought... SOLUTION!

  • the fitting of the image in the field including AutoFit options are not displayed on my options panel of the selections Tools toolbar

    The fitting of the image in the field including AutoFit options are not displayed on my options panel to toolbar for the selection tools. How can I view?

    You're out of space. Some toolbar has been resized/re-spaced in the last update. Click on the menu button (on the far-right in your screenshot) and select Customize... Make sure that the mounting frame (object) is selected. If this is the case, you should disable something else to make room for this group of button.

    Furthermore, I see that your application window is not maximized. What happens if you expand to the maximum it?

  • Stupid question CS6. How can I get rid of my experience after using the quick selection tool?

    Stupid question CS6. How can I get rid of my experience after using the quick selection tool?

    The best way would be to make sure that your layer is not a background layer: click the lock icon in this case. Then click the icon at the bottom of the layer panel layer mask. This will create a mask that you can refine and not be destructive.

  • Photoshop Elements 14 Quick Selection tool breaks

    I often use the quick selection tool to clone or highlight areas of the image for the special edition. Invariably, after several weeks of use, it stops working. It does not have the AutoFill feature nor can I enclose an area for further editing. In the past, I just uninstalled and reinstalled Photoshop Elements. Last week, not even this method worked. This was also a problem in Photoshop elements 11, in my experience. What is the cause of the problem and what is the solution?

    A simple reset will often do the trick. Go to this link and select the Quick Selection tool:

    Difficulty of tool

  • Problem Selection tool

    Hello

    I use the latest version of Photoshop CC and in all the documents, I try to use the marquee selection tool, I get a warning:

    WARNING: No pixel is selected more than 50%. Selected edges will be visible.

    Is this a bug or am I the only one having this problem?

    Thank you

    Martine

    In the option bar to put the pen in zero

Maybe you are looking for