2 Replies Latest reply on Aug 1, 2016 7:58 AM by oleh.melnyk

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

    oleh.melnyk Level 3

      Hi,

       

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

       

      I found this:

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

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

       

      But those works only in Photoshop... So is it possible to get currently selected tool name in InDesign? Is there a universal method that will work in other apps?

        • 1. Re: Is it possible to get selected tool name from a script?
          Pickory Level 3

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

           

          P.

          • 2. Re: Is it possible to get selected tool name from a script?
            oleh.melnyk Level 3

            Yeah!

             

            In InDesign - app.toolBoxTools.currentToolName works, but in other apps - not... anyway thanks!

             

            UPD: this is what I came up for now

            function getCurrentTool(){
                if(app.name.indexOf("Photoshop") !== -1){        
                    return app.currentTool;
                }else if (app.name.indexOf("InDesign") !== -1){
                    return app.toolBoxTools.currentToolName;
                }else{
                    var appName;
                    if(app.name == "bridge"){
                        appName = app.name.charAt(0).toUpperCase() + app.name.slice(1); // Capitalize "bridge" => "Bridge"
                    }else{
                        appName = app.name.slice(6); // Removes "Adobe " from the app.name: "Adobe Illustrator" => "Illustrator"
                    }
                    return "Seems like " + appName + " is not supported! :(";  
                }    
            }
            

             

            Any suggestions and improvements are highly appreciated!