-
Notifications
You must be signed in to change notification settings - Fork 1
Samples
Sami Ylönen edited this page Dec 5, 2015
·
9 revisions
- Create a view configuration
- Set Config name to "Sample1"
- Set Path to view to "Sample1"
- Set Use current foregorund window
- Create a single action with a name "SampleAction"
- Create a sequence that presses Esc and Left Control modifier
- Save configuration
In your DATAROOT\Web\Views should now be a folder called "Sample1"
- Enter the folder
- Download jquery and place it in this folder (jquery-1.11.3 used in this sample)
- Create index.html in the folder and paste the code below
Now, from the management portal press "Open" for the Sample1 view
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, user-scalable=no initial-scale=1" />
<meta name="viewport" content="height=device-height, user-scalable=no initial-scale=1"/>
<title>Sample1</title>
<script src="jquery-1.11.3.js"></script>
</head>
<body>
<button id="button" data-action="SampleAction">Sample Button</button>
<script>
var configName = "Sample1";
var config = null;
$(document).ready(function() {
$.get( "/api/action/getconfiguration?name="+ configName, function( response ) {
config = response.content;
});
});
$("button").click(function(e) {
if (config === null)
return;
var actionName = $(this).data("action");
var action = getAction(actionName);
$.post("/api/action/execute", {
useForegroundWindow: config.useForegroundWindow,
useDesktop: config.useDesktopWindow,
uprocessName: config.processName,
inputAction: action
});
});
function getAction(actionName) {
for (var i = 0; i < config.actions.length; i++) {
var action = config.actions[i];
if (action.hasOwnProperty("name") && action.name === actionName)
return action;
}
return null;
}
</script>
</body>
</html>
Try modifying the sample by adding more buttons and more actions
Add css and use some other elements than just buttons