LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Browse Folder or File

I need to make a search Folder/File in my Application to use the path finded, as he was search of windows.
 
Thanks! 
0 Kudos
Message 1 of 6
(4,340 Views)
Aren't DirSelectPopup and FileSelectPopup enough for your needs or am I misunderstunding your question?


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 6
(4,330 Views)
Thanks Roberto, but I need that the function search a file into hard disk and return your path for a file and not that I indicate manually a local for open file with pop-up.
0 Kudos
Message 3 of 6
(4,326 Views)

Ah, I understand now!

Well, you could probably write down your own function that searches the whole disk scanning the directories starting from radix of disk and using GetFirstFile / GetNextFIle functions, but it will be tedious and not so easy to debug...

In such a case I would prefere to use OS commands, for example using DIR to search the file, redirecting output to a text file and reading that last one to get the path. In your case you may create an instruction like for example LaunchExecutable ("cmd /c dir c:\\yourfile.txt /s /b > c:\\outfile.txt"): this string searches the whole disk for "yourfile.txt" and returns its full path (and nothing else Smiley Wink ) in the output file "c:\outfile.txt". Depending on the dimension of your disk, this function may take a while (...well, a *long* while Smiley Surprised ) to execute, so you may need to use LaunchExecutableEx instead and verify in a loop that the command is terminated while you are flasking some led on the screen or updating a progress bar or so.

Look in help for DIR command options, which are a lot of and can be useful to delimit your search and speed up the process. The good thing in using this comand is that you can interactively test it without need to write down any line of code Smiley Happy



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 4 of 6
(4,316 Views)
Ok!! The function GetFirstFile only search in current path, not search in sub-folders. But the tip of dos is very interesting, I will be using for the moment, thanks!
0 Kudos
Message 5 of 6
(4,300 Views)


@Sandiver wrote:
Ok!! The function GetFirstFile only search in current path, not search in sub-folders.


That's why I told you that it's not a trivial task: you must structure a function that searches from a start path and:

  1. For the first thing scans for files
  2. Next scans for directories and recursively calls itself for each of them to proceed scanning
  3. Handling all the exceptions, end of lists and so on...

Smiley Surprised

 

The good old DOS has saved me a lot of headhaches Smiley Wink

Message Edited by Roberto Bozzolo on 07-13-2007 05:13 PM



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 6 of 6
(4,299 Views)