Skip to content

Instantly share code, notes, and snippets.

@jarrodbell
Created March 21, 2012 05:45
Show Gist options
  • Save jarrodbell/2144878 to your computer and use it in GitHub Desktop.
Save jarrodbell/2144878 to your computer and use it in GitHub Desktop.
Basic Command Queuing for CommandFusion
/* Basic Command Queuing for CommandFusion
USAGE:
- First step: Replace the "SYSTEM NAME GOES HERE" text towards the end of the script with your actual system name as defined in the System Manager of your GUI project
- Next: Save this script into a .js file and add it to your GUI project via Project Properties > Script Manager.
- Ensure you are using iViewer4 (NOT CF iViewer, legacy product without JavaScript support)
- within button properties, add a JavaScript call such as:
CommandQueue.startCommand("StartDataGoesHere");
- Then to add more commands to the queue, add a JavaScript call to another button such as:
CommandQueue.addCommand("StartDataGoesHere");
- Then to finally send the queued commands, add a JavaScript call to another button such as:
CommandQueue.endCommand("StartDataGoesHere");
*/
var CommandQueue = {
theQueue: "",
startCommand: function (firstCommand) {
// Clear the queue: setting it to an empty string, or the command value passed to the function call
firstCommand = (firstCommand === undefined) ? "" : firstCommand;
theQueue = firstCommand;
},
addCommand: function (theCommand) {
theQueue += theCommand;
},
finishCommand: function (endCommand) {
theQueue += endCommand;
CF.send("SYSTEM NAME GOES HERE", theQueue);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment