-
Notifications
You must be signed in to change notification settings - Fork 1
Scripting
Note: This scripting part is not done, and can be quite buggy.
In the Scripts page, click "Add script".
Add a name for the script, and add source file(s) by clicking "Add source".
For each source file you add, write a file name for it.
You can reorder the scripts when you've added all you need. Execution order matters, place libraries first.
Press save.
You can now find the script entry, folder and js files from DATAROOT\Scripts.
The .js file you intend to be your main "executable" needs to have this methdod
function execute() {
}
When done you can call this.
executionCallback(true) // true = request rerun of the script.
execute() will be called by the engine when it's run.
See https://github.com/samiy-xx/keysndr/blob/master/Portal/scripts/app/keys.js for possible keys
pause(1000); //pause for 1000 milliseconds
sendInput("Tab"); // Sends tab key
moveMouse(5, 5); // Move mouse cursor to absolute position x, y
moveMouseRelative(5, 5); // Moves mouse relative x, y from current position
clickMouse(1, 100); // Click button and keep down for 100 milliseconds. 1 = left, 2 = right, 3 = middle
var action = createAction();
var sequence1 = createSequenceFromString(200, "Tab"); //Keep key down for ms, Name of the key
var sequence2 = createSequenceFromInt(200, 69) // Keep key down for ms, int value of the key
var sequence3 = createStringAction("Some message here", 200); // String message, Keep each key down for ms
appendSequence(action, sequence1);
appendSequence(action, sequence2);
appendSequence(action, sequence3);// Adds the 3 sequences in the action
sendInputAction(action); // Sends the action
// Just sending a string message without creating action and sequences separately
sendString("Message", 200);
C# System namespace, KeySndr.Base and KeySndr.Common
Interval like functionality
var Utils = importNamespace("KeySndr.Base.JsUtils");
var timer = new Utils.JsTimer();
var timesRun = 0;
timer.Tick(function() {
sendInput("Tab");
if (timesRun == 5) {
timer.Stop();
}
});
timer.Start(0, 400); // Delay to start, interval. Milliseconds
When editing/creating an action. Right next to the "add sequence" button is also a "add script" button. Click that and select the script you created.
The script is run when the action is executed.