11-08-2021 07:01 PM
Hi folks,
I want to add multiple files from a folder in an array but I want to add them one by one. After adding the desired number of files, I want the code to be stopped and use the array for other purposes. It's easy to give a path to folder and build array but the selection of the files. I want the code to prompt for which file I want to add and keep doing it until I added the desired number of files and then cancel the prompt to stop the code.
Seeking ideas.
11-08-2021 07:32 PM
Seems trivial. What have you tried?
In a proper state machine, the code will not "stop", just proceed to another state, e.g. for the "other purpose", or to an idle state waiting for the next command. So you want an automatic prompt for each file? When should the adding of file stop? (E.g. if the file dialog is canceled?)
11-08-2021 08:06 PM
Hi altenbach,
At the moment I am at the point of thinking how this can be done. Once I ll have an idea, doing it won't be an issue.
This is exactly I want "So you want an automatic prompt for each file? When should the adding of file stop? (E.g. if the file dialog is canceled?)"
11-09-2021 02:57 AM
I'd pop up a dialog VI that has a cluster array of a Boolean and a FileName. Tick the ones you want, press OK and it filters those out and continue.
11-09-2021 09:59 AM - edited 11-09-2021 10:01 AM
A few more ideas:
I would stay away from repetitive file dialogs, because they make it difficult to see what has already been picked, for example.
11-09-2021 10:27 PM
Thank you guys for the ideas.
Just last thing, the chosen files are going into array in alphabetic order rather than in the order I am clicking them. I want the file to go at the top of the array which is clicked first in the folder and vice versa.
11-10-2021 10:55 AM
Try Sort 1D Array.vim (assuming you have LV 2021).
11-10-2021 11:02 AM
@HassanIqbal wrote:
Just last thing, the chosen files are going into array in alphabetic order rather than in the order I am clicking them. I want the file to go at the top of the array which is clicked first in the folder and vice versa.
You can use a multicolumn listbox (similar to already suggested) and display a sequence number with every click in the second column, then sort entries by that value at the end. (Of course you need mechanisms to undo and edit later, e.g. if you accidentally clicked in the wrong order. You should also add some sanity checks to prevent entering the same path twice.
11-10-2021 11:04 AM
@Eric1977 wrote:
Try Sort 1D Array.vim (assuming you have LV 2021).
That's the opposite. The OP does NOT want them sorted, but in the order they have been clicked.
11-10-2021 01:04 PM - edited 11-10-2021 01:06 PM
Ah. Read that post too fast.
With that said, it looks like the the native Windows dialog wants to reorder the files as they are selected. This Stack Overflow post reads like it is doing just that and developers should "roll their own" mechanism.