12

Is there a way to setup a keyboard shortcut to run a custom script in Illustrator? So far I haven't found a way. If this is not possible to do from within Illustrator, is there a 3rd party solution for that?

4 Answers 4

14

3rd party solutions


Automator ( Mac - Native app )

Recently made a video about this.

  1. Create a new Service
  2. At the top: Service receives [no input] in [Adove Illustrator CC 2015.app]
    • If you don't specify application here, you can launch the script when any window is active, which can be useful.
  3. Search and add action: Get Specified Finder Items.
    • Add the .jsx script here.
  4. Search and add action: Open Finder Items.
    • Open with: "Adobe Illustrator CC 2015.app"
  5. Save service: Cmd+S
    • Make sure you remember the name for this next step
  6. Go to OSX System preferences > Keyboard > Shortcuts
  7. You should be able to find your script under General
    • Add a shortcut for it.

Alfred ( Mac - £17 to unlock feature required to do this )

Automator does this same thing quite well, but I always have to mention Alfred, since it has a few benefits:

  • You got the workflow and the hotkey in one place.
  • Store multiple shortcuts in one place. In this screenshot I'm triggering the script file with applescript, but Alfred does have a "Open file" action too.
  • You can trigger scripts and do other things by using keywords.
  • File Filters - Here's a Gif where I'm using a file filter to search my Photoshop scripts stored in a specific Dropbox folder. It uses a fuzzy search so you only have to remember one word in the script name in order to find it. Excellent if you got tons of scripts. Makes it a lot easier to use scripts that you don't use very often.
  • It can sync workflows through Dropbox, so you can easily use the same scripts and the same shortcuts on a new computer just by installing Dropbox and Alfred.

Recently made a video about this. Not the best video quality. Forgot to record it full screen.

  1. Alfred Preferences > Workflows tab
  2. From the bottom left: Click the + icon and add Blank Workflow
    • Give it a descriptive Workflow Name: and press Create
  3. From the top right: Click the + Icon and add Triggers > Hotkey
    • In the first tab Hotkey settings, set a hotkey combination
    • In the second tab Related Apps, drag Illustrator.app inside the window and Save
  4. From the top right: Click the + Icon and add Actions > Open File
    • Drag your .jsx file to that first box on the left
    • Drag Illustrator.app to the second box on the right and Save
  5. Drag a line from the right side of the Trigger to the left side of the Action to connect them.

Autohotkey ( Windows - Free )

  1. Add this code below to a new notepad document:

#IfWinActive, ahk_class illustrator
^!.::Run, Illustrator.exe C:\Users\joonas\Desktop\test.jsx

  1. Save that with an extension .ahk
  2. You can open that file in the default app (ahk).
    • You should see it running in the System tray under a green H icon ( enter image description here ).
    • You can close it from the System tray via context menu.
  3. If you want the hotkey to always be accessible (and not just when you remember to open the .ahk file), just put the file in the windows startup folder.
  4. Remove the first line of the code, if you want to be able to trigger the script from any application.

Note that if you don't plan your hotkeys carefully, this can block other hotkeys from Illustrator or other applications, if you decide to get rid of that first line.

6
  • Thanks for the detailed answer... even video! Perfect solution.
    – Dummer
    Commented Nov 20, 2015 at 1:32
  • 1
    It is very easy to create context-sensitive hotkeys in Windows. If you scroll down a little you'll see how.
    – user53083
    Commented Mar 3, 2017 at 2:03
  • @FighterJet I couldn't get it to work, the last time I played with it. I think the problem I couldn't get over was that this relies on the application window title and Illustrator window title consists of the document name. Not sure if I'm remembering that right though. Either way, I've not been able to figure out how to make it work in Illustrator specifically.
    – Joonas
    Commented Mar 3, 2017 at 7:53
  • 1
    @Joonas: Each window has a name, but it also has a class. In the case of Illustrator, this is simply illustrator. So you would just use #IfWinActive, ahk_class illustrator, then put your hotkey beneath that.
    – user53083
    Commented Mar 3, 2017 at 15:27
  • @FighterJet Thanks. Finally had a change to try it and sure enough, that does work. Updated the answer.
    – Joonas
    Commented Mar 8, 2017 at 19:11
4

You can create an action which calls the script via the Insert Menu Item command, then assign an F-key shortcut to the action.

Fixed now.. However, Illustrator fails to retain script designations in actions when you quit the application (long standing bug). So, this means every time you launch AI you have to reset the action to see the script.

2
  • See this answer for a workaround for that bug.
    – jan-glx
    Commented Nov 1, 2016 at 17:14
  • You might want to update this as its now possible to do this without illustrator actually forgetting it.
    – joojaa
    Commented Oct 4, 2018 at 8:37
2

For the Mac, Spark is a fantastic app that easily lets you set shortcuts for illustrator scripts (File>Scripts) as well as other oft-used menu items you want to setup.

0
2

Good news!

In Illustrator 2018 there is a work around.

Adding a custom script to an Action now retains the script when you close and re-open Illustrator so you can now create an action to record your script then assign a keyboard shortcut to the action... finally!

3
  • This is great news, now they just need a way to "send" this back to the CS6 edition...
    – Welz
    Commented Oct 18, 2018 at 2:48
  • I'm on Illustrator 2025-mac. It's not working :'/ (cannot record Action for File>Scripts>*script*) Commented Nov 11 at 12:52
  • EDIT! It's working! In Actions panel hamburger menu, choose >Insert Menu Item... and there you can search any menu item! Oh so cool :'o Found the answer here: scriptsfordesigners.com/resources/… Yay! Commented Nov 11 at 13:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.