Page 1 of 1

Running Javascript through AutoHotkey

Posted: Fri Jul 19, 2019 2:01 pm
by Five_One_15
Hello, have begun with JavaScript yesterday. I have been scripting in AHK to potentiate a numpad. Got around 450 shortcuts, 70 slower (>200 ms), and the rest bellow 200 ms for execution. But I found a quantitative bottleneck: it seems you can record ~44 actions and assign shortcuts to ~36 scripts, before overriding defaults.

Solution 1: Getting actions to run JavaScripts -- No, net loss
Solution 2: The reverse -- Same
Solution 3: Run actions with AHK -- No, actions that do not have a shortcut assigned are not accessible
Solution 4: Run JavaScripts with AHK -- here is what I am trying to do.

Simplest way is to run the file with a hotkey:

Code: Select all

a:: 
Run, SomeJavaScript.jsx, C:\Users\Me\Documents\Adobe Scripts\
return
But that seems to generate a slight, but noticeable delay, specially unwanted for fast, single action scripts. Would still be useful for less prioritary hotkeys. But what about invoking functions within a permanently open JavaScript through artifitial keystroke events, is it possible? Would that perform faster, since the script is already open? I can only find examples concatennated with HTML, and Adobe`s PDF reference does not display addEventListener, as I have seen used elsewhere:

Code: Select all

document.body.addEventListener("keydown", function(event) {
    if (event.keyCode == 13) {
        alert("Hello! You pressed the enter key!");
    }
});
From: https://stackoverflow.com/questions/530 ... nput-field.

Re: Running Javascript through AutoHotkey

Posted: Tue Dec 22, 2020 10:33 pm
by Hellen-arndt89
Hi Five_One_15, did you ever find a solution to this issue?
I have run into the same issue myself and am scratching my head for solutions. please feel fre to let me know.

Re: Running Javascript through AutoHotkey

Posted: Wed Dec 23, 2020 12:27 am
by Kukurykus
Perhaps VBScript will be useful, Adobe took care to make documentation for using it with Photoshop.