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-03-03 07:16:08 +00:00
|
|
|
exports.create = function() {
|
|
|
|
return new ToolkitObject();
|
|
|
|
};
|
2022-02-14 07:03:55 +00:00
|
|
|
|
2022-03-03 07:16:08 +00:00
|
|
|
exports.getInterface = function() {
|
|
|
|
return exports.create().getInterface();
|
|
|
|
};
|
2022-02-14 07:03:55 +00:00
|
|
|
|
2022-03-03 07:16:08 +00:00
|
|
|
exports.sendClick = function(wName, x, y, retry) {
|
|
|
|
var i = 0;
|
|
|
|
while (i < retry) {
|
|
|
|
exports.getInterface().SendClick(wName, x, y);
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
};
|
2022-02-14 07:03:55 +00:00
|
|
|
|
2022-03-03 07:16:08 +00:00
|
|
|
exports.sendKeys = function(wName, s) {
|
|
|
|
return exports.getInterface().SendKeys(wName, s);
|
|
|
|
};
|
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-03-03 07:16:08 +00:00
|
|
|
exports.alert = function(message) {
|
|
|
|
return exports.getInterface().Alert(message);
|
2022-02-14 07:03:55 +00:00
|
|
|
};
|
|
|
|
|
2022-03-03 07:16:08 +00:00
|
|
|
exports.confirm = function(message) {
|
|
|
|
return exports.getInterface().Confirm(message);
|
|
|
|
};
|
2022-03-03 06:11:39 +00:00
|
|
|
|
2022-03-03 07:16:08 +00:00
|
|
|
exports.prompt = function(message, _default) {
|
|
|
|
return exports.getInterface().Prompt(message, _default);
|
|
|
|
};
|