Skip to main content
Mohkhasa
Participating Frequently
June 26, 2022
Answered

[Help] Run Illustrator actions directly from AHK(AutoHotKey) script

  • June 26, 2022
  • 1 reply
  • 2289 views

Hello,

 

I am trying to run Illustrator actions directly from AHK(AutoHotKey) script,  just like the below but for Illustrator.

z::
if WinActive("ahk_class Photoshop")
{
	psApp := ComObjActive("Photoshop.Application")
	psApp.DoAction("action name", "action set name")
}
return

 

I tried multiple versions, like the following: but it didn't work

z::
if WinActive("ahk_class illustrator")
{
	aiApp := ComObjActive("illustrator.Application")
	aiApp.DoAction("action name", "action set name")
}
return

 

How can I adjust this command for Illustrator?

 

Thank you

This topic has been closed for replies.
Correct answer CarlosCanto

Illustrator's Object Model is different than photoshop's, so scripts for one app won't work on the other.

 

You can start with the official guides adobe provides

 

check this post for links and resources

https://community.adobe.com/t5/illustrator-discussions/javascript-reference-for-adobe-illustrator/m-p/12911518#M320092

1 reply

CarlosCanto
Community Expert
June 27, 2022

use DoScript instead of DoAction

New Participant
June 21, 2023

Hi, 

I tried  DoScript in Autohotkey to trigger Illustrator to call an action named (Split) inside the action set called (Flashman)
my code :

=============

^+x::
if WinActive("ahk_class illustrator")
{
app := ComObjActive("Illustrator.Application")
app.DoScript("Split", "Flashman")
}
return

============

I also tried this code but no luck

^+D::

app := ComObjActive("Illustrator.Application")
doc := app.activeDocument
ie := ComObjCreate("Illustrator.Actions")


ie.DoAction("Split", "Flashman")
return

Could you guide me to make it happen, please?
Thanks a lot.

New Participant
June 22, 2023

Double check the action and folder name, the below code is working fine for me:

 

    #q::
        app := ComObjActive("illustrator.Application")
        app.DoScript("vertical dist space","Mohkhasa")
    return

 

 


Thanks a lot, CarlosCanto 

, and thanks to you too  Mohkhasa 

I confirm it works fine after I install Illustrator 2023.

Still not working V.2021
Thanks for your time.