autohotkey.js
v1.1.13
Published
Make AutoHotKey Scripts In JavaScript
Downloads
3
Readme
AutoHotKey.js
Make AutoHotKey Scripts In JavaScript
Documentation
Test Results
Coverage Report
Examples
Basic Script
require('autohotkey.js').init('Name Of File');
on('^t', function () {
send('Hi');
});
Which Outputs
^t::
Send, Hi
Return
Basic Script With If Statement
require('autohotkey.js').init('Name Of File');
on('^t', function () {
If(winExist('"Untitled - Notepad"'), function () {
send('Notepad Open');
})
});
Which Outputs
^t::
if (winExist("Untitled - Notepad")) {
Send, Notepad Open
}
Return
Basic Script With If/Else Statement
require('autohotkey.js').init('Name Of File');
on('^t', function () {
If(winExist('"Untitled - Notepad"'), function () {
send('Notepad Open');
}).Else(function () {
send('Notepad Not Open');
});
});
Which Outputs
^t::
if (winExist("Untitled - Notepad")) {
Send, Notepad Open
}
else {
Send, Notepad Not Open
}
Return
Basic Script With Variables
require('autohotkey.js').init('Name Of File');
on('^t', function () {
set('Variable', '"Untitled - Notepad"');
If(winExist(get('Variable')), function () {
send('Notepad Open');
}).Else(function () {
send('Notepad Not Open');
});
send(get('Variable').contents());
});
Which Outputs
^t::
Variable := "Untitled - Notepad"
if (WinExist(Variable)) {
Send, Notepad Open
}
else {
Send, Notepad Not Open
}
Send, %Variable%
Return
Runing Functions
get('Variable').get('Function').run('"Argrument"');
winExist(get('Variable').get('Function').runInline('"Argrument"'));
Store Output Script In Variable
const autohotkey = require('autohotkey.js');
var script = new autohotkey.Script();
autohotkey.init('Name Of File', script);
on('^t', function () {
send('Hi');
});
Script Object
Script {
text: '^t::\n Send, Hi\nReturn\n',
name: 'Name Of File.ahk',
getText: function () {...},
setText: function (text) {...},
getName: function () {...},
setName: function (name) {...}
}