Skip navigation
Le tom
Currently Being Moderated

Shortcut for js script  with CS4 ?

May 19, 2010 7:58 AM

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.

 
Replies
  • Currently Being Moderated
    May 20, 2010 12:19 AM   in reply to Le tom

    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

     
    |
    Mark as:
  • Currently Being Moderated
    May 26, 2010 3:44 AM   in reply to Le tom

    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 ..

     
    |
    Mark as:
  • Currently Being Moderated
    May 26, 2010 4:58 AM   in reply to artchrome

    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

     
    |
    Mark as:
  • Currently Being Moderated
    May 27, 2010 12:58 AM   in reply to Le tom

    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

     
    |
    Mark as:
  • Currently Being Moderated
    May 27, 2010 2:01 AM   in reply to Le tom

    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

     
    |
    Mark as:
  • Currently Being Moderated
    May 28, 2010 3:43 AM   in reply to Le tom

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 1, 2010 1:53 AM   in reply to artchrome

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 13, 2010 1:44 AM   in reply to chris gebab

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 13, 2010 8:46 AM   in reply to chris gebab

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 14, 2010 3:28 AM   in reply to chris gebab

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 2, 2010 12:57 AM   in reply to chris gebab

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 2, 2010 3:02 AM   in reply to artchrome

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 2, 2010 3:55 AM   in reply to Muppet Mark-QAl63s

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 2, 2010 8:25 AM   in reply to chris gebab

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 2, 2010 11:37 PM   in reply to Muppet Mark-QAl63s

    Thank you, that makes it much clearerer to me.

    i will do that (look for Xbytors posts).

     

    chris

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 30, 2010 6:18 AM   in reply to artchrome

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 30, 2010 7:07 AM   in reply to fivan

    ....

     

    renaming the script ".jsx" it works correctly

     

    I can't believe it

     

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 16, 2012 3:56 PM   in reply to fivan
     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points