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

Community Beginner ,
Jun 26, 2022 Jun 26, 2022

Copy link to clipboard

Copied

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

TOPICS
How to , Scripting

Views

109

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Adobe Community Professional , Jun 26, 2022 Jun 26, 2022

use DoScript instead of DoAction

Likes

Translate

Translate
Adobe Community Professional ,
Jun 26, 2022 Jun 26, 2022

Copy link to clipboard

Copied

use DoScript instead of DoAction

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 27, 2022 Jun 27, 2022

Copy link to clipboard

Copied

Thank you CarlosCanto, 

 

Do you know any good resources to learn more about this? so I can adjust the below for Illustrator

6::
;ExportJPG
    app := ComObjActive("Photoshop.Application")
    doc := app.activeDocument
    options := ComObjCreate("Photoshop.ExportOptionsSaveForWeb")
    options.Quality := 90
    options.Format := 6 ; 6=jpeg 13=png 17=tif
    options.Optimized := ComObj(0xB, -1) ; 0xB = VT_Bool || -1 = true, 0 = false

    ;inputBox, filename, file name, file name(no extension)
    filename := app.activeDocument

    WinActivate, ahk_class Photoshop
    doc.export(doc.path . filename.name . ".jpg",SAVEFORWEB:=2,options)
    ;this works, but it does
    ;thumb-atx-12-vo.psd.jpg
    ;instead of
    ;thumb atx 12 vo.jpg
return

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jun 27, 2022 Jun 27, 2022

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 27, 2022 Jun 27, 2022

Copy link to clipboard

Copied

LATEST

Super useful, thanks alot! 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines