Created
March 21, 2012 05:45
-
-
Save jarrodbell/2144878 to your computer and use it in GitHub Desktop.
Basic Command Queuing for CommandFusion
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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