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: xbytor, DavideBarranca, Paul MR

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

Running Javascript through AutoHotkey

Post by Five_One_15 » Fri Jul 19, 2019 2:01 pm

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

Run, SomeJavaScript.jsx, C:\Users\Me\Documents\Adobe Scripts\
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: ... nput-field.

Post Reply