More than one rack in same script
Shows how and why to use multiple racks in same script.
Can Easy Control handle more than one rack in same script? Yes !
But for what ? Maybe you don't want to clutter one rack window with all controls at a time.
Or maybe you must follow a specific program flow. Maybe you want some controls to change
appearance or functionality on a specifc action or data.
How to do: a simple code like that:
openrack (rack1.res)
....................
openrack (rack2.res)
will open rack1 and then rack2. This is useful when you want to switch racks based on some
data, say if voltage is greater than xx then change to rack2 where a different scale for
an instrument is used.
If you want to switch racks on user action you must provide a control to test for this action.
A small example:
Build in Rack Designer two racks, say first.res and second.res. Put in first.res a power button
named pbutton1 and in second.res a power button named pbutton2.
Write an EasyControl script like this:
openrack (first.res)
again:
if (pbutton1==1)
openrack (second.res)
endif
if (pbutton2==1)
openrack (first.res)
endif
goto again
This example will open first rack, and will wait user to click on pbutton1. When this happens, second
rack will be open, and will wait user to click on pbutton2, switch to first rack, and again, and again...
It is possible to name the controls in racks with the same name, but the script must be changed in
this way, where power buttons was named pbutton1 in both racks:
openrack (first.res)
first:
if (pbutton1==1)
openrack (second.res)
goto second
endif
goto first
second:
if (pbutton1==1)
openrack (first.res)
goto first
endif
goto second
I think is very simple and with some imagination one can build very powerful instrumentation.
Enjoy !