I use the XML file/string functions to load/save the state of controls
between VI executions. It has never been a problem in the past, but
with this new project I need to save a DAQmx Task control. The control
is a drop-down box that lists the DAQmx tasks that were setup in
Measurement and Automation Explorer. So the value from this control
(which is of type DAQmx Task) is passed to the XML file and then read
from the XML file on a later execution of the VI.
The problem is, the value of a DAQmx Task boils down to an ID that
changes between LabVIEW executions. I have a DAQmx Task called
"MyDigitalOutTaskTest". I execute my code, select the task
"MyDigitalOutTaskTest" from the drop down, and then stop the code so
that the XML file is written. I check my XML file it has this entry:
<Refnum>
<Name>Digital Output Task:</Name>
<RefKind>Generic Tag</RefKind>
<RefType>NIDAQ</RefType>
<Val>0x0694E1E0</Val>
</Refnum>
While LabVIEW is not running, I switch the control to some other DAQmx
task and hit the "run" button. The VI behaves as expected, looks up
the value of the control from the XML file and switches the control to
the entry "MyDigitalOutTaskTest".
Now, I fully exit LabVIEW, re-launch LabVIEW, open the VI, and hit the
"run" button. This time "MyDigitalOutTaskTest" is not selected from
the dropdown and instead it is a blank field. *sigh*. I select the
task from the dropdown and stop my VI which then dumps a new .XML file
containing the control settings. Looking in my XML file, I find that
the <Val> tag's value has changed:
<Refnum>
<Name>Digital Output Task:</Name>
<RefKind>Generic Tag</RefKind>
<RefType>NIDAQ</RefType>
<Val>0x06CCB968</Val>
</Refnum>
I run the same procedure, and again I get a different number: 0x07B24D70
So this value is dynamic. Now what? What property from the control do
I use to save to the XML and can use to load from the XML file so this
work as desired. I would still very much like to use the DAQmx Task
drop down control, as this has a nice interface that has updated values
with new DAQmx Task entries as well as a browser that can be used to
edit a task.
-Nic