LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to make a program that will ask for a name the first time the program is used and if is not the first time will not ask the name?

I want to make a program that will ask for the ID of the testing machine the first time the program is running, then will never ask for it. I'm using Labview 6.0
0 Kudos
Message 1 of 4
(2,283 Views)
Hi

There are a Couple of methods you can use for this.

Method 1 -
You can create an ini file and save a boolean Key "First Instance" as True. Now In your Program you read this Key, If it is True then you can show your ID Dialog VI.If False do not run the VI. At the Conclusion of Id Dialog you can update this registry enrty to False. So In effect you have created One time Event. In fact you can save ID as another Config entry.

The Drawback and advantage is that such an INI file can be edited by someone moderately knowledgeable about the Program

Method 2
Use Unitialized Shift Register in A while Loop. Please see LV2 style Globals entry under this forum. You can read and write to this Variable and it retains the Value it last had within it.

You can read
this Global the Very first time and say if it true you display your ID Vi. If False you dont. When you display your ID Vi you can Update your Global Like Before.

If you need Example Let me Know.

Good Luck

Mache!!
Good Luck!

Mache
0 Kudos
Message 2 of 4
(2,283 Views)
Unless I'm misunderstanding you I don't think that Method 2 will work if you build the VI into an EXE and then deploy it.

The other option is to use the RegisterKey VIs and read and write to the Registry a la the INI suggestion. I like using that route more than INIs as they require considerably more expertise on the part of an end-user to "muck up".
0 Kudos
Message 3 of 4
(2,283 Views)
Hi

You are right - The LV2 Global will not work if the Program is closed and Labview is exited and restarted.
I was thinking along the Lines of "First Call" Fucntion available in the Advanced->Synchronization Palette.

The Method 1 will work however. You can use registry Keys too to keep track of "Instance" What ever suits fine.

I for one do not like to use Ini or Registry. I use controls on my front panel and save them dynamically using "Save Defaults" Method. So every time my front panel opens the defaults saved from last time are available at hand.

This method takes some practice and care while building exe's.

Thanks for Correcting
Regards,

Mache
Good Luck!

Mache
0 Kudos
Message 4 of 4
(2,283 Views)