Created
November 8, 2011 16:09
-
-
Save paragontechgroup/1348208 to your computer and use it in GitHub Desktop.
Command Fusion Global Tokens
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
// 1) Created global token (in global token manager) called "ProcessorPort" with default value 8020 and checked persist. | |
// 2) Created system called "Localhost" to 127.0.0.1 | |
// 3) Created setup page with text input field with serial join 9999 with command "setPort" in "Send Value Actions > command" | |
// 4) Created command in "Localhost" system called "setPort" with following Javascript: | |
CF.setToken(CF.GlobalTokensJoin, "[ProcessorPort]", "[@s9999]"); | |
// 5) Made button on setup page called "What is my port" with code: | |
CF.getJoin(CF.GlobalTokensJoin, function(j, v, tokens) { var guiPort = tokens["[ProcessorPort]"]; CF.setJoins([{join: "s590", value: guiPort}]); }); | |
// This grabs the global token "[ProcessorPort]" and displays it in serial join s590 for testing. All works like a champ until I restart guiDesigner. I'd assume that from a fresh start and navigating to the setup page and pressing the "What is my port" button that the set persistent global token value would be displayed. Also, even from a fresh start pressing the "What is my port" button does not display the peristent global token "[ProcessorPort]" value, I'd think it would at least display 8020 since that was set as the default. | |
// Also just tested an init.js fle in the script manager with the intention to prepopulate the port input field with the port defined in the global persistent tokens. This seems to have no effect: | |
// Initialize GUI | |
CF.userMain = function() { | |
// iViewer initialization is now complete and the CF environment is fully available | |
// Read the global context that we need | |
restoreContext(); | |
}; | |
function restoreContext() { | |
// Read the contents of the ProcessorPort token | |
CF.GetJoin(CF.GlobalTokensJoin, function(join, value, tokens) { | |
var contextStr = tokens["ProcessorPort"]; | |
if (contextStr != null && contextStr.length > 0) { | |
CF.setJoins([{join: "s9999", value: contextStr}]); | |
} | |
}); | |
} |
AWESOME! THANKS!
…-----Original Message-----
From: Florent Pillet [mailto:[email protected]]
Sent: Friday, November 11, 2011 4:41 PM
To: Pete Toborek
Subject: Re: gist gist: 1348208
There seems to be an issue with CF.setSystemProperties() where it won't really take the change if you only change the port when accessing the control system using a direct IP address. Thanks for nailing this.
I noted your comments on IRC regarding the fact that setting a different IP address in the GUI, then updating it using CF.setSystemProperties() fails to connect. I'll figure out what's wrong and fix it in a couple days ( and will add proper logging of the address it's trying to connect to in the Script system log for good measure).
Florent
---
Reply to this email directly or view it on GitHub:
https://gist.github.com/1348208
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There seems to be an issue with CF.setSystemProperties() where it won't really take the change if you only change the port when accessing the control system using a direct IP address. Thanks for nailing this.
I noted your comments on IRC regarding the fact that setting a different IP address in the GUI, then updating it using CF.setSystemProperties() fails to connect. I'll figure out what's wrong and fix it in a couple days ( and will add proper logging of the address it's trying to connect to in the Script system log for good measure).
Florent