09-29-2015 10:09 AM
Hi All.
Just wondering if it is possible to write to a file path control. At the moment I am using file path control for user selectable info which is then written to a config file. Upon start I want the config read to write to the same file path control. Instead I have to read the config file to a file path indicator instead which is not ideal. Is there any way in which I can directly write to the file control???
Mark.
Solved! Go to Solution.
09-29-2015 10:11 AM - edited 09-29-2015 10:13 AM
This depends how your code is set up. Are you trying to set the value from a different VI or are you writing it in the same VI? You can use a local variable to set the control value, or you can use a property node.
If you are setting the value from a different VI all together then you need to include a Refnum to the path control when you run the config VI, then use this reference to write the value with a property node.
If what I'm saying is gibberish, it would be easier to show you using your own code, so please share the code for better help.
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'
09-29-2015 10:26 AM
Hi James.
In the VI attached the setup section is what I am referring to. I tried using variables from the read config file section but I still cannot write them to the file path control.
Mark.
09-29-2015 10:47 AM - edited 09-29-2015 10:51 AM
Right-click the control on the front panel and select Create Local Variable. Then drop this variable at the same place that you have the indicator terminals. This will write the value to the control.
You'll hear a lot of people say that you should avoid local variables (race conditions, hard to debug, etc), but in this instance they're okay. I use them all the time to initialize my user interface from a config file.
P.S. Have you put more thought in to re-writing the code?
P.S.S. Did you take my picture in school 15 years ago?
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'
09-29-2015 10:47 AM
There's a lot to look at in that VI. Here's a simple example. I'll let you figure out how to integrate it into the mess you've made elsewhere. (Why would you have a terminal wired to nothing and then create ONE local variable that you read from that value instead!?)
09-29-2015 11:38 AM
That did the trick thanks.
I have alraedy written some of the code. There are sub vi's there. It was actually much bigger, i know its hard to believe. Not sure what you mean about school picture 15 years ago.
Mark.
09-29-2015 12:39 PM - edited 09-29-2015 12:40 PM
It was a joke (not a very good one ). Your VI name is "Lifetouch" which is the name of a large photography business that does school photos for a lot of schools, including my own.
Bigger than what you've shared? Yikes!
Please mark the solution(s) that best match your original thread topic, so others can find this solution in the future if they have the same question.
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'
09-30-2015 04:07 AM
Never heard of them.