LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error while getting directory details.

Hi,
I am using a list directory to perform remote read and write operations. I do not have any problem in getting the file path for read operations. But for write operations, I get a 'Not a path' message when ever I select a folder and give a file name.

I have enclosed my small code with this thread. Can some one please help.
0 Kudos
Message 1 of 5
(2,744 Views)
It's because of how you exit your smaller While loop. Your logic is set up so that if the user double-clicks on the listbox OR clicks on "Save" OR clicks on "Cancel" OR there is an error, the program exits the loop. The next piece of the program to run is dependent on the output of the Dbl-Click property - even if that isn't what the user clicked on! So in those cases you get a value of 0 from Dbl-Click and the program falls apart when it uses this 0 in the part that builds pathnames and you end up with a bad path that it then tries to tack the value of the "Save As" control onto.

I think your program would benefit from a bit more thought about its structure. If it was based around an Event structure or a State Machine, you would be able to know exactly what
the user had clicked on, rather than that they'd just clicked on *something* and be really specific about what code gets run in each case.

Hope this helps,
James.
Message 2 of 5
(2,744 Views)
Hi,
The problem is from the "Build path"-function. If you don´t double-click in the list box the property node in the polling-loop returns -1 and if you terminate the polling-loop by pressing "Save" this -1 value will be passed to the index array-function.
From this function you will get an empty sting and when you build a path with a empty string this will give "Not a path".
Do you understand what I mean?

A solution would be a case-structure around this "Build Path" that could prevent this from executing when "-1" is returned from the polling loop!
I will attach my solution. I think it works, but I haven´t tested it thoroughly.

regards
Robert S
National Instruments Sweden
Message 3 of 5
(2,744 Views)
Ah yes, the property value is -1, not zero like I said.

I knew I should have had that extra hour in bed! 🙂
0 Kudos
Message 4 of 5
(2,744 Views)
Thanks for your help.It worked fine.
0 Kudos
Message 5 of 5
(2,744 Views)