LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Write to file path control

Solved!
Go to solution

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.

0 Kudos
Message 1 of 8
(3,634 Views)

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>   ---'


0 Kudos
Message 2 of 8
(3,632 Views)

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.

 

 

0 Kudos
Message 3 of 8
(3,620 Views)
Solution
Accepted by topic author MarkGreally

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.

Local Var Path.PNG

 

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>   ---'


Message 4 of 8
(3,603 Views)

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!?)

0 Kudos
Message 5 of 8
(3,600 Views)

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.

 

 

0 Kudos
Message 6 of 8
(3,579 Views)

It was a joke (not a very good one Smiley Very Happy). 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>   ---'


0 Kudos
Message 7 of 8
(3,556 Views)

Never heard of them.

0 Kudos
Message 8 of 8
(3,506 Views)