This is an old revision of the document!
A token is basically a variable that you can store data in or retrieve data from at runtime in your guiDesigner projects. A token has a name and a value.
A token can be named anything you like, but we suggest you follow the syntax above, including the square brackets in your token names. By doing this, it makes it easier to see where your token is actually being used within command values, etc.
There are three types of tokens:
As the name suggests, a global token is available to be used globally throughout your guiDesigner project.
Global tokens are defined in Project Properties > Global Token Manager.
A global token is the only type of token that can be set to persist its data across launches of iViewer, so you can store state data and retrieve it again the next time iViewer is opened.
There are a number of tokens that are predefined for you in certain cases, depending where the token is being used.
[ipv4address]- The IP Address of the device.
[ipv4netmask]- The subnet mask of the device.
[ipv4addresshex]- The IP Address of the device, in hex bytes.
[ipv6address]- The IPv6 Address of the device.
[ipv6netmask]- The IPv6 subnet mask of the device.
[MACAddress]- The MAC Address of the device.
[join]- The join number and join type of the object, e.g. 'd10' for a digital join of a button, 's4' for the serial join of an image object, 'a12' for the analog join of a slider object.
[@<join_type><join_num>]- Get the 'value' of a specific join. eg:
[@s10]would return the value of serial join 10.
[@d5]would return the value of digital join 5.
[@<join_type><join_num>:<token_name>]- Same as above, but returning the value of a specific token assigned to a specific join. eg.
[@l5:[count]]would return the number of list items in the list assigned join 5.
Any object within a list (button, slider, image, etc) will automatically have the following tokens attached to it:
[list_join]- The join number of the list that the object resides in
[item_index]- The list index (zero based) of the list item that the object resides in.
[count]- The total number of items the list contains.
[visible]- The total number of items that are currently visible within the list.
[top]- The index of the first visible item within the list.
[scrolloffset]- The scroll position of the list in pixels.
See the gesture wiki entry for details on the predefined tokens available for gesture actions.
[sliderval]- The numerical value of the current slider position, based on the slider's min and max settings.
[inputval]- The string value of the input field's current text.
Tokens can be used throughout your guiDesigner project in a number of ways: