2021-08-10 11:39:27 +00:00
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
// WelsonJS.Toolkit API
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
var ToolkitObject = function() {
|
|
|
|
this.interface = null;
|
|
|
|
|
|
|
|
this.create = function() {
|
|
|
|
try {
|
|
|
|
this.interface = CreateObject("WelsonJS.Toolkit");
|
|
|
|
return this;
|
|
|
|
} catch (e) {
|
2022-02-14 06:43:14 +00:00
|
|
|
console.warn("WelsonJS.Toolkit is disabled");
|
2022-02-28 08:52:24 +00:00
|
|
|
console.warn(e.message);
|
2021-08-10 11:39:27 +00:00
|
|
|
}
|
|
|
|
};
|
2022-02-14 07:03:55 +00:00
|
|
|
|
2022-03-03 07:16:08 +00:00
|
|
|
this.getInterface = function() {
|
|
|
|
return this.interface;
|
2022-02-14 06:43:14 +00:00
|
|
|
};
|
|
|
|
|
2022-03-03 07:16:08 +00:00
|
|
|
this.create();
|
|
|
|
};
|
2022-02-14 07:03:55 +00:00
|
|
|
|
2022-10-20 19:03:06 +00:00
|
|
|
function create() {
|
2022-03-03 07:16:08 +00:00
|
|
|
return new ToolkitObject();
|
2022-10-20 19:03:06 +00:00
|
|
|
}
|
2022-02-14 07:03:55 +00:00
|
|
|
|
2022-10-20 19:03:06 +00:00
|
|
|
function getInterface() {
|
|
|
|
return create().getInterface();
|
|
|
|
}
|
2022-02-14 07:03:55 +00:00
|
|
|
|
2022-10-20 19:03:06 +00:00
|
|
|
function sendClick(wName, x, y, retry) {
|
2022-03-03 07:16:08 +00:00
|
|
|
var i = 0;
|
|
|
|
while (i < retry) {
|
2022-10-20 19:03:06 +00:00
|
|
|
getInterface().SendClick(wName, x, y);
|
2022-03-03 07:16:08 +00:00
|
|
|
i++;
|
|
|
|
}
|
2022-10-20 19:03:06 +00:00
|
|
|
}
|
2022-02-14 07:03:55 +00:00
|
|
|
|
2022-10-20 19:03:06 +00:00
|
|
|
function sendKeys(wName, s) {
|
|
|
|
return getInterface().SendKeys(wName, s);
|
|
|
|
}
|
|
|
|
|
|
|
|
function sendFnKey(wName, num) {
|
|
|
|
return getInterface().SendFnKey(wName, num);
|
|
|
|
}
|
2022-02-14 07:03:55 +00:00
|
|
|
|
2022-03-03 07:16:08 +00:00
|
|
|
// https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html
|
2022-03-03 06:11:39 +00:00
|
|
|
|
2022-10-20 19:03:06 +00:00
|
|
|
function alert(message) {
|
|
|
|
return getInterface().Alert(message);
|
|
|
|
}
|
2022-02-14 07:03:55 +00:00
|
|
|
|
2022-10-20 19:03:06 +00:00
|
|
|
function confirm(message) {
|
|
|
|
return getInterface().Confirm(message);
|
|
|
|
}
|
2022-03-03 06:11:39 +00:00
|
|
|
|
2022-10-20 19:03:06 +00:00
|
|
|
function prompt(message, _default) {
|
|
|
|
return getInterface().Prompt(message, _default);
|
|
|
|
}
|
|
|
|
|
|
|
|
exports.create = create;
|
|
|
|
exports.getInterface = getInterface;
|
|
|
|
exports.sendClick = sendClick;
|
|
|
|
exports.sendKeys = sendKeys;
|
|
|
|
exports.sendFnKey = sendFnKey;
|
|
|
|
exports.alert = alert;
|
|
|
|
exports.confirm = confirm;
|
|
|
|
exports.prompt = prompt;
|
|
|
|
|
|
|
|
exports.VERSIONINFO = "WelsonJS.Toolkit API version 0.3";
|
2022-11-25 14:11:37 +00:00
|
|
|
exports.AUTHOR = "abuse@catswords.net";
|
2022-10-20 19:03:06 +00:00
|
|
|
exports.global = global;
|
|
|
|
exports.require = global.require;
|