Just a caveat.
I am on Ubuntu (Linux) and need to reinstall Windows 10 before I can start testing AutoHotKey scripting. I don't know how to import Javascript into AHK,
However, meanwhile I suggest that you install Actiona from here:
https://jmgr.net/
Action is based on Qt4 and runs cross platform. Javascript is its main language, but Python, Selenium etc can be added.
Then you can either use Actiona to supplement AHK scripting, or using the binary .. actexec .. you can run the script from AHK. That is, the Actiona GUI is not needed after the script is tested.
Your test javascript has been placed in a Code object and a MessageBox used instead of alert.
I can see AHK and Actiona working together. AHK can drive Actiona and vice versa as subprocesses.
Take the xml script below and change extension to .ascr before running
either as GUI or through actexec.
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<scriptfile>
<settings program="actiona" version="3.10.1" scriptVersion="1.1.0" os="GNU/Linux"/>
<actions>
<action name="ActionCode" version="1.0.0"/>
<action name="ActionMessageBox" version="1.0.0"/>
</actions>
<parameters/>
<resources/>
<script pauseBefore="0" pauseAfter="0">
<action name="ActionCode">
<exception id="0" action="0" line=""/>
<exception id="1" action="0" line=""/>
<exception id="2" action="1" line=""/>
<parameter name="code">
<subParameter name="value" code="1">var x = 10;
var y = 10;
// alert(res(200,300)+" & "+ res(400,500)); // MsgBox
Console.print(res(200,300)+" & "+ res(400,500));
var msg = (res(200,300)+" & "+ res(400,500));
function res(cw,ch){
var cw, ch;
var rw1 = Math.floor(cw/x);
var rw2 = Math.floor(ch/y);
var rh1 = Math.floor(ch/x);
var rh2 = Math.floor(cw/y);
var resRw1 = rw1*rw2;
var resRw2 = rh1*rh2;
var max = Math.max(resRw1,resRw2);
return max
}</subParameter>
</parameter>
</action>
<action name="ActionMessageBox">
<exception id="0" action="0" line=""/>
<exception id="1" action="0" line=""/>
<exception id="2" action="1" line=""/>
<parameter name="customIcon">
<subParameter name="value" code="0"></subParameter>
</parameter>
<parameter name="icon">
<subParameter name="value" code="0">none</subParameter>
</parameter>
<parameter name="ifNo">
<subParameter name="action" code="0">do_nothing</subParameter>
<subParameter name="line" code="0"></subParameter>
</parameter>
<parameter name="ifYes">
<subParameter name="action" code="0">do_nothing</subParameter>
<subParameter name="line" code="0"></subParameter>
</parameter>
<parameter name="message">
<subParameter name="value" code="0">$msg</subParameter>
</parameter>
<parameter name="textMode">
<subParameter name="value" code="0">automatic</subParameter>
</parameter>
<parameter name="title">
<subParameter name="value" code="0">Result</subParameter>
</parameter>
<parameter name="type">
<subParameter name="value" code="0">ok</subParameter>
</parameter>
<parameter name="windowIcon">
<subParameter name="value" code="0"></subParameter>
</parameter>
</action>
</script>
</scriptfile>