From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to check string control to see if it has a valid windows file name (no illegal characters like * / > " : |).

Does LabVIEW have a built-in function to check an input string to see if it contains a valid Windows file name?  In other words, is a function available that will check to see if a file name does not contain a * ? / | \ : or some other illegal character?  Do you have to write your own function to check this?
 
Thanks
0 Kudos
Message 1 of 38
(5,538 Views)
I found another post that was similar, but it seems the conclusion was that you would have to do your own checking, unless you use the NI file dialog.

It shouldn't take too long to do your own checking, simple for loop to cycle through the letters.
Kenny

0 Kudos
Message 2 of 38
(5,522 Views)

Yeah, I saw that post, as well, but didn't feel like it addressed my specific question.  I hope I didn't offend anyone by posting a similar question.

It does appear then that a self written function is necessary.  It's funny how something this common isn't in a built-in function (unless you use the file dialog, which is built-in).  Too bad you can't configure a string control with an expected input (file name, number, phone number, social security number, etc) and have the string control automatically validate the data input.  That would be cool.

Thanks to you, Kenny K, for taking the time to answer my post.

0 Kudos
Message 3 of 38
(5,515 Views)
"Too bad you can't configure a string control with an expected input (file name, number, phone number, social security number, etc) and have the string control automatically validate the data input. That would be cool."

Well, make your own sub VI for that, then.
You could also submit it as a feature request, of course.
0 Kudos
Message 4 of 38
(5,509 Views)

Thanks, DJDDA, for the reply.  It does appear I will have to write my own code to perform this function.  I just expected it to be built-in somewhere.  Seems like a common function (especially for file names).

Where is this feature request form I hear so much about?  I would like to submit this for future releases of LabVIEW.

Thanks, again, to all who replied.

0 Kudos
Message 5 of 38
(5,504 Views)
Attached is a simple checker that should work for you.  Saved in 8.5 and 8.2.
 


Message Edited by Kenny K on 02-01-2008 12:52 PM
Kenny

Message 7 of 38
(5,492 Views)

Oops, forgot to check the valid case, Smiley Surprised

Seems that in the valid case, it will still think there is a ^ character present, giving you a false output.  Any ideas??

Kenny

0 Kudos
Message 8 of 38
(5,485 Views)

sorry, got click happy with my ultra slow internet at work....Smiley Mad



Message Edited by Kenny K on 02-01-2008 12:59 PM
Kenny

0 Kudos
Message 9 of 38
(5,484 Views)

Thanks, smercurio_fc, for the link to the Product Suggestion page.  I added in my suggestion that some common masks be available for automatic input validation by LabVIEW (phone number, social security number, zip code, file name, etc).  I think the string control should have this functionality, and maybe it will someday.

Kenny K, thanks so much for the code!!!  I didn't realize it was so easy!  I am glad it is such a small chunk of code, which won't slow down processing too much.  Your solution is very elegant, simple, and very much appreciated.  I can't thank you enough.

Thanks to all posters who helped me out.

0 Kudos
Message 10 of 38
(5,482 Views)