NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Do not change StationGlobal.ini in RunTime

Solved!
Go to solution

Hi, in my application I am using the station global not only to configure the Test Station. The user (developer) must have the chance to change these variables in Edit mode, but I would like to lock the file during runtime for 2 main reasons:

  1. The user can change some values of the StationGlobals during the test, but at the start of the test, It should always has the same default values. I could restore the default values at the end of the test, but...it is not the fix.
  2. Twice during run time, it happened that the application crashed during the refresh of the StationGlobal deleting all the values set.

I could protect file using windows property, but in that case, user cannot access to the file in Edit mode.

 

Any ideas?

 

Thanks.

0 Kudos
Message 1 of 4
(3,433 Views)

Hey logatto,

 

You can make the file read-only during run time.  So basically at the beginning of your sequence or in your process model before anything executes.  Then at the end change it back to normal.

 

One way to do this is to use the Call Exe step and call the cmd.exe process.  There is a command called ATTRIB that changes file attributes.  The +R and -R switches will make it read-only and not read-only respectively. 

 

Hope this helps,

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 2 of 4
(3,398 Views)
Solution
Accepted by topic author logatto

Hi Logatto,

 

If you want to programmatically access to the file properties so you would be able to lock it, you could refer to the "Deny Access.vi" function. I suggest you to evaluate the links posted below for additional informations.

 

- Forum

How to deny access to a configuration file

 

- Knowledge Base

When Creating a New File in LabVIEW, What is the Difference Between Deny Mode and FilePermissions?

 

I hope it could helps,

Let me know if you need more support.

 

Have a great day!!!

 

Matteo
0 Kudos
Message 3 of 4
(3,360 Views)
Thanks All.
0 Kudos
Message 4 of 4
(3,353 Views)