I'm working a lot with InDesign and I always wanted to be able to run an InDesign script directly from Autohotkey however I never managed to. I ended up assigning a shortcut to a script and then have Autohotkey to modify its content, select InDesign and send the shortcut. This was working however it was not what I wanted.
Yesterday a friend figured out how to do it and here it is, in case anyone needs it:
Code: Select all
Enabled := ComObjError(false) ; this is to avoid getting an error in case the script fails and so tha tthe script continues after the INDD script rans (same as run instead of ranwait) use true to make it like run.
ID := ComObjCreate("InDesign.Application")
if script not contains .jsx,.js
ID.doScript(script `, 1447185511) ; this code is to run visual basic scripts or any exe file
else
ID.doScript(script `, 1246973031) ; this is for javascript
The variable script contains the full path of the script to be run. The only problem i have with this is that the Autohotkey script does not continue until the InDesign script is fully executed, if anyone knows how to avoid that, please let me know!