Consider these two commands that are often used together:
1. GetFileList>filespec,result
2. Separate>list,delimiter,returnvar
- The first imposes a semicolon ; as the delimiter
- The second let's us choose our own delimiter
Semicolon ; is a valid char in a filename so if you have filenames
full of semicolons, Separate> isn't going to do you much good.
Could GetFileList> be enhanced to let us choose our own delimiter?
GetFileList>filespec,result,delimiter
Then we could just choose a delimiter that's not a valid character in
a filename and the Separate> command would work perfectly every time.
If you added the delimiter at the end and made it optional, you'd even
keep backward compatibility, default could still be the semicolon ;
unless something else was specified.
Anyone else run into this problem? If so, how did you get around it?
Oh, and a big thanks to Bob Hansen, Lumumba, Marcus and others...
I've learned a lot from your posts in the Forums here.
[Done] Ability to Choose Delimiter in GetFileList> Comman
Moderators: Dorian (MJT support), JRL
[Done] Ability to Choose Delimiter in GetFileList> Comman
Last edited by jpuziano on Sat Sep 27, 2008 7:19 am, edited 7 times in total.
jpuziano
Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post -
Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post -
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
A bit like this ...Could GetFileList> be enhanced to let us choose our own delimiter?
StringSplit
--------------------------------------------------------------------------------
Separates a string into an array of substrings using the specified delimiters.
StringSplit, OutputArray, InputVar [, Delimiters, OmitChars, FutureUse]
Added a Poll
Added a Poll per your suggestion Bob and used your suggested rankings:
5. Important, even if the size/efficiency increases/degrades
4. Somewhat important
3. I'm okay either way
2. Somewhat unimportant
1. Unimportant, even if the size/efficiency remains unaffected
Thanks again!
5. Important, even if the size/efficiency increases/degrades
4. Somewhat important
3. I'm okay either way
2. Somewhat unimportant
1. Unimportant, even if the size/efficiency remains unaffected
Thanks again!
jpuziano
Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post -
Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post -
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
I found this vbscript somewhere and adjusted it to work in MSChed. It's not as fast as GetFileList, but it does work, and it's flexible.
VBSTART
Function filelist (dirname)
Dim fso, f, f1, fc, s
Dim listcount
listcount = 0
Set fso = CreateObject("Scripting.FileSystemObject")
Set fold = fso.GetFolder(dirname)
Set fc = fold.Files
For Each f1 in fc
s = s & f1.name & ","
listcount = listcount + 1
Next
MsgBox("Found " & listcount & " items.")
filelist = s
End Function
VBEND
Rem> ****** Begin - Parts that can be edited
Let>MyDir=C:\My\Folder\
Rem> ****** End - Parts that can be edited
Rem>' Check that %MyDir% exists
IfDirExists>%MyDir%,DirExists
MessageModal>Directory does not exist;%CRLF%%MyDir%
Goto>TheEnd
Label>DirExists
VBEval>filelist("%MyDir%"),sList
Message>%sList%
Label>TheEnd
I hope it is of some use to someone, even if just as a vbscript example.
I have a similar one that can be used to obtain directory names only.
(Edit: Actually, it seems this one is VERY fast at getting the filenames and returning the list in to the var! 1000 items return in about 1/2 a second on my pc.)
VBSTART
Function filelist (dirname)
Dim fso, f, f1, fc, s
Dim listcount
listcount = 0
Set fso = CreateObject("Scripting.FileSystemObject")
Set fold = fso.GetFolder(dirname)
Set fc = fold.Files
For Each f1 in fc
s = s & f1.name & ","
listcount = listcount + 1
Next
MsgBox("Found " & listcount & " items.")
filelist = s
End Function
VBEND
Rem> ****** Begin - Parts that can be edited
Let>MyDir=C:\My\Folder\
Rem> ****** End - Parts that can be edited
Rem>' Check that %MyDir% exists
IfDirExists>%MyDir%,DirExists
MessageModal>Directory does not exist;%CRLF%%MyDir%
Goto>TheEnd
Label>DirExists
VBEval>filelist("%MyDir%"),sList
Message>%sList%
Label>TheEnd
I hope it is of some use to someone, even if just as a vbscript example.
I have a similar one that can be used to obtain directory names only.
(Edit: Actually, it seems this one is VERY fast at getting the filenames and returning the list in to the var! 1000 items return in about 1/2 a second on my pc.)
The next release allows an optional delimiter to be used in GetFileList as suggested. Default is semi-colon. New syntax will be:
GetFileList>filespec,result[,delimiter]
GetFileList>filespec,result[,delimiter]
MJT Net Support
[email protected]
[email protected]
Excellent, thank you Support.
Also, thanks Captive for the VBScript example.
Also, thanks Captive for the VBScript example.
jpuziano
Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post -
Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post -