Running Javascript through AutoHotkey

Anyone, especially newbies, asking for help with Photoshop Scripting and Photoshop Automation - as opposed to those contributing to discussion about an aspect of Photoshop Scripting

Moderators: Tom, Kukurykus

Five_One_15
Posts: 1
Joined: Fri Jul 19, 2019 12:21 pm

Running Javascript through AutoHotkey

Post 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.
Hellen-arndt89
Posts: 5
Joined: Mon Dec 21, 2020 10:53 pm

Re: Running Javascript through AutoHotkey

Post 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.
User avatar
Kukurykus
Posts: 528
Joined: Mon Jul 25, 2016 12:36 pm

Re: Running Javascript through AutoHotkey

Post by Kukurykus »

Perhaps VBScript will be useful, Adobe took care to make documentation for using it with Photoshop.