LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

read string from keyboard (similar to scanf)

Dear all,

 

I am trying to implement a high-score table, i.e. if some criteria is met, the user has to input a string, which is then written to a file. 

 

Is there a way to implemet a text query at a certain stage in the flow in labview?

 

Any help is greatly appreciated.

 

Best wishes

 

Chris

0 Kudos
Message 1 of 9
(5,829 Views)

Hi ne7e9g,

 

I would start with a string control - you can "implement" that in every "stage in the flow" 😉

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 9
(5,827 Views)

Thanks for the quick reply.

 

I guess the question is: how do I pause the flow until the user has entered its credentials (at runtime) and pressed enter?

 

many thanks in advance,

 

chris

0 Kudos
Message 3 of 9
(5,818 Views)

Ahh,  now it becomes more clear...

 

Maybe you need some pseudocode to help you in writing programs:

repeat
  check string input
wait for small amount of time until ENTER key or BUTTON press

 To make it clear: you would use a loop that stops when your input is given...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 9
(5,813 Views)

I would make a new VI as a dialog box to make the user input data into a string control.  Use dataflow to "pause" the program while the dialog is up.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 9
(5,779 Views)

Thanks, that worked like a charm, at least using the button to stop the loop. The string control is only really writen to a variable once the while loop has finished so that I cannot query if the last value is a carriage return. any ideas on that would be awesome.

 

Many thanks

 

PS Screenshot attacht (program was running)

 

labview001.png

0 Kudos
Message 6 of 9
(5,764 Views)

To solve your problem you could do this: Move the indicator inside the loop. Also right click on the string input and select "Update Value while typing"

However, you could use set focus property on your Done button and let Labview do the work for you. To set this, right click on your button >> Properties >>Key Navigation Tab >> Select "Return" in the Toggle drop down box.

hope this helps.


CLA CTAChampionI'm attending the GLA Summit!
Subscribe to the Test Automation user group: UK Test Automation Group
0 Kudos
Message 7 of 9
(5,762 Views)

awesome forum!!!! thanks for all the speedy replies. it works great!!!

 

take care

chris

0 Kudos
Message 8 of 9
(5,745 Views)

Its actually pretty common to use a pop-up dialog box to prompt user for input.  In fact its so common there is even an Express vi by that exact same name "Prompt User for Input.vi" which polls the users input.

 

Of course, Polling should be replaced by Events now that the Event structure is in all versions of LabVIEW so I keep an arsenal of these in my reuse code.

Smiley Frustrated Silly Snippett tool

Prompt(String)_BD.png


"Should be" isn't "Is" -Jay
0 Kudos
Message 9 of 9
(5,737 Views)