21 Replies Latest reply: Aug 16, 2012 3:56 PM by [Jongware] RSS

    Shortcut for js script  with CS4 ?

    Le tom Community Member

      hi all,

      with my old version of illustrator (CS), i might affect a shortcut to a specific scipt .

      Now i have CS4 version, and i  don't find similar possibility.

       

      how can affect in this new version ?

       

      Thanks for futur answer.

        • 1. Re: Shortcut for js script  with CS4 ?
          artchrome Community Member

          Hi Le Tom,

           

          A know a way (may be there are anothers). So..

           

          Put your script (javascript JSX) in illustrator/preset/your_language/Scripts/my_script.jsx (for MAC OS X)

           

          Restart illustrator

           

          Right now your script should be appear in illustrator's menu at : File -> Script -> my_script

           

          So.. use Script Action palette to call my_script:

          1- Make folder

          2- Make layer Script Action and attribute a shortcut Key (F2 for exemple).

          3- In Script Action menu (at top right corner) use Insert Command

          4- write in dialogbox my_script (if your press the search button, it should be found, ** for me, first time illustrator crash, but after i have called/running manually my_script and remake this step and it's Ok**)

          5 - Close/End Script Action

           

          to try, push F2

           

          Note: i have a French version of Illustrator CS4, so may be some commands/pathway could be named differently

           

          Ciao, art.chrome

          • 2. Re: Shortcut for js script  with CS4 ?
            Le tom Community Member

            thanks,

            i try, it works  a first time,

            but when i stop  AI an restart him, the script is loaded without the command with specific script.

            Have you same issue ?

            • 3. Re: Shortcut for js script  with CS4 ?
              artchrome Community Member

              Salut le Tom,

               

              Le tom wrote:

              but when i stop  AI an restart him, the script is loaded without the command with specific script.

              Have you same issue ?

               

              Unfortunately, yes ..

              • 4. Re: Shortcut for js script  with CS4 ?
                chris gebab Community Member

                on windows i use the system shortcuts (Alt+key+key....) to step thru the menus file>scripting....

                 

                on mac maybe this can help?

                http://www.manytricks.com/butler/

                 

                Chris

                • 5. Re: Shortcut for js script  with CS4 ?
                  Le tom Community Member

                  i wish only one shotcut  to run a script.

                  i think use an action to run script may be a good idea.

                   

                  Maybe should i creat a jsx script , running at start of AI, which create (or modifiate) action ?

                  Can i do it ?

                   

                  In Adobe Scripting Document, it says "a script can execute action" . Can it create to ?

                  • 6. Re: Shortcut for js script  with CS4 ?
                    chris gebab Community Member

                    yes, we all think that (I think so), and some people reported it works, but for me and many others sadly not

                     

                    yes,  it says "a script can execute action" .

                    But why don't they tell you how?

                    I have never heard from one who has it done .

                     

                    Da ist der Wunsch der Vater des Gedanken

                    or

                    If  wishes were horses. beggars would ride

                     

                    this is what i know(or believe) (from 10 to cs3)

                     

                     

                    Chris

                    • 7. Re: Shortcut for js script  with CS4 ?
                      artchrome Community Member

                      Hi le Tom,

                       

                      Le tom wrote:

                       

                      i wish only one shotcut  to run a script.

                       

                      by my previous propose, you can do this, indeed you need to make it each time you open illustrator, but how time you re-open illustrator by day ?

                      In fact , i'm asking me what kind of repeatitive task you made ? may be there are another solution to make it same thing...

                      Other way is: File -> Script -> my script

                      Le tom wrote:


                      Maybe should i creat a jsx script , running at start of AI, which create (or modifiate) action ?

                      Can i do it ?

                      want you make script (jsx) which able to make script action (illustrator) ? what is real goal ?

                       

                      Regards, art.chrome

                      • 8. Re: Shortcut for js script  with CS4 ?
                        Le tom Community Member

                        artchrome wrote:


                        Le tom wrote:


                        Maybe should i creat a jsx script , running at start of AI, which create (or modifiate) action ?

                        Can i do it ?

                        want you make script (jsx) which able to make script action (illustrator) ? what is real goal ?

                         

                        Regards, art.chrome

                        yes, why not,

                        it's an alternative, but i don't know if it's possible.

                        • 9. Re: Shortcut for js script  with CS4 ?
                          artchrome Community Member

                          hi,

                           

                           

                          Le tom a écrit:

                           

                          artchrome wrote:


                          Le tom wrote:


                          Maybe should i creat a jsx script , running at start of AI, which create (or modifiate) action ?

                          Can i do it ?

                          want you make script (jsx) which able to make script action (illustrator) ? what is real goal ?

                           

                          Regards, art.chrome

                          yes, why not,

                          it's an alternative, but i don't know if it's possible.

                          Possible ( i think) but It's not easy way , save an Illustrator action script and open it with a text editor, you will understand what i mean

                          Moreover jsx is able to make more thing than illustrator action script, more quickly also...

                           

                          Regards, art.chrome

                          • 10. Re: Shortcut for js script  with CS4 ?
                            chris gebab Community Member

                            what's about a system shortcut( with hot key ) to a .jsx (#target illustrator)?

                            Ok, nobody needs the confim window in this case, and the time needed to start the estk.

                            But it is a easy way.

                             

                            chris

                            • 11. Re: Shortcut for js script  with CS4 ?
                              chris gebab Community Member

                              Much better, without estk and confirm-prompt:

                              a shell / batch-script to call Illustrator with the js-script as param.

                              for windows like this (.bat or .cmd):

                              @echo off 
                              "C:\...\Support Files\Contents\Windows\illustrator.exe" "C:\...\Vorgaben\Skripten\e_prompt.js" 
                              
                              
                              
                              

                              store it wherever, create a link to it on the desktop, set link property's: hot-key and execute:minimized

                              okay, this works systemwide but it works, so who cares.

                               

                               

                              Chris

                              • 12. Re: Shortcut for js script  with CS4 ?
                                chris gebab Community Member

                                better again, for windows of course:

                                 

                                tasklist | findstr /i "illustrator.exe" 1>NUL 2>&1 || exit 
                                Start "" "...pathTo...\Support Files\Contents\Windows\illustrator.exe" "...pathTo...\SCRIPTNAME.js"
                                

                                 

                                first line exits if Illustrator is not running.

                                second line "runs" Illustrator with skript as param.

                                Ive tried it also with VBS, but command.com is much faster than WSH, so DOS is better here .

                                Save as *.bat or *.cmd, create a link to it on the desktop, set link property's: hot-key and  execute:minimized

                                XP-home users must download tasklist.exe first, and save it to \windows\system32\

                                works great!

                                 

                                Who knows how this can be done on Apple?

                                Apple-script or better Bash-script?

                                 

                                Chris

                                • 13. Re: Shortcut for js script  with CS4 ?
                                  chris gebab Community Member

                                  okay, i fetched a bash emulator for windows and wrote this *.sh script:

                                   

                                  #!/bin/bash
                                  ps | grep -i -e illustrator.exe 1>/dev/null 2>&1 || exit
                                  "C:/Programme/Adobe/Adobe Illustrator CS3/Support Files/Contents/Windows/illustrator.exe" C:/Programme/Adobe/Adobe Illustrator CS3/Vorgaben/Skripten/e_prompt.js
                                  

                                   

                                  double clicking and it works.

                                  unfortunately a Illustrator-message appears before the script starts: "path/to/script.js    fichier introuvable". (file not found?)(but the script starts!!!   ?strange)

                                  I don't know,

                                  is this a problem with the emulator?

                                  is there a mistake in the third line?

                                  I can't say this, it's on you, Mac-users.

                                  for testing you can copy the second and third line in a shell-window.

                                  of course, the paths has to be edited to your needs.

                                   

                                  Chris

                                  edit: i found that the second path (the argument) has to be in Windows-notation (on my windows-machine), so Unix-machines should not get this message

                                  • 14. Re: Shortcut for js script  with CS4 ?
                                    artchrome Community Member

                                    Hi Chris & le Tom (if you continue to follow this post ),

                                     

                                    There is interesting file here (on MAC OS X  CS4):

                                     

                                    /Library/Application support/Adobe/Startup  Scripts CS4/Illustrator/illustrator-14.0.jsx

                                     

                                    This file  is running just after illustrator is loaded & just before it loading  pop-up papnel !

                                     

                                    I think you can find this file also on  PC at (for CS3):

                                     

                                    Programs Files/commons  files/Adobe/Startup Scripts CS3/Illustrator/illustrator-13.0.jsx

                                     

                                    I  didn't seen something for older version of illustrator..

                                     

                                    Regards,  art.chrome

                                    • 15. Re: Shortcut for js script  with CS4 ?
                                      Muppet Mark-QAl63s Community Member

                                      If you are on the mac then you could use a utility to add keyboard shortcuts to various scripts for apps including Illustrator. 'FastScripts' by 'Red Sweater' is an AppleScript one that adds an extra menubar item with dropdown lists of all you favorite scripts (AppleScript of cause) but then there is no reason why this could NOT just be a wrapper to calling a JavaScript file to execute within the app… This works for me… You would need a complied AppleScript wrapper for each of you script files but its very easy to see how to edit AppleScript. Here is an example of the wrapper…

                                       

                                       

                                      set Apps_Folder to (path to applications folder as text)
                                      set Scripts_Path to "Adobe Illustrator CS2:Presets.localized:Scripts.localized:"
                                      set JS_FileName to "Hello_World.jsx"
                                      --
                                      try
                                           set JS_File to Apps_Folder & Scripts_Path & JS_FileName as alias
                                           tell application "Adobe Illustrator"
                                                do javascript JS_File show debugger on runtime error
                                           end tell
                                      on error
                                           display dialog "Script file '" & JS_FileName & "' NOT found?" giving up after 2
                                      end try
                                      
                                      

                                       

                                       

                                      Just change the file name string in line 3 & also the folder name for your version of Illustrator in line 2

                                      This utility will let you add keyboard shortcuts to which ever scripts you want once added.

                                      • 16. Re: Shortcut for js script  with CS4 ?
                                        chris gebab Community Member

                                        hi guys,

                                        art, i will have look at this stuff, thank you.

                                        mark, this is in Principe what i want, great!

                                        please allow me a few questions:

                                        "Compiled" because of the hotkey? or the executability (can i say so?)? or both?

                                        is it possible to compile it "on the fly" when writing this file from a script?

                                        how long is the delay from pressing the hotkey to script execution?

                                         

                                         

                                        Chris

                                        • 17. Re: Shortcut for js script  with CS4 ?
                                          Muppet Mark-QAl63s Community Member

                                          Chris, a couple of things that may be of interest to you but I don't have a great deal of knowledge or experience with.

                                           

                                          On OSX for a shell (bash) to be executable from JavaScript it must first have it bit permissions set. Even with this and why I have NOT personally done anything with this is it only works with CS4 & CS5 (may be CS3). If you want to create/write shell's on the fly then this can be done by creating a directory with set permissions before hand. Then writing your files below this should set them executable too. Xbytor who posts in the Photoshop does do this on the mac. You should search that forum for his examples…

                                           

                                          AppleScript is a different matter as the syntax of script has to be compiled into file. The quick key solution that I posted here is NOT one that could be done on the fly as the Utility needs to load the compiled scripts at startup and you assign keys via it's preferences. So this would NOT be a solution to you but possibly to the original poster. (At least its NOT going to forget at app restart)…

                                           

                                          As a side note AppleScript 'syntax' can be executed by shell using 'osascript -e'

                                          And a text file can be compiled using 'osacompile' but these are long and messy options.

                                           

                                          mark.

                                          • 18. Re: Shortcut for js script  with CS4 ?
                                            chris gebab Community Member

                                            Thank you, that makes it much clearerer to me.

                                            i will do that (look for Xbytors posts).

                                             

                                            chris

                                            • 19. Re: Shortcut for js script  with CS4 ?
                                              fivan Community Member

                                              Hi All.

                                               

                                              My problem is a little bit out of topic but may be you can help me anyway.

                                               

                                              in CS5, I put my ".jsxbin" script in "scripts" folder but after restarting Illustrator, my script is not included in the script list.

                                              Also in the dialog window I can't select "jsxbin" scripts insted of "jsx".

                                               

                                              Why?

                                               

                                              thanks

                                               

                                              Ivan

                                              • 20. Re: Shortcut for js script  with CS4 ?
                                                fivan Community Member

                                                ....

                                                 

                                                renaming the script ".jsx" it works correctly

                                                 

                                                I can't believe it