Page 1 of 1

can i get folder Contents in a drop list

Posted: 22 Aug 2014 15:30
by yusef88
can i get folder Contents in a drop list and filter them by .exe

Re: can i get folder Contents in a drop list

Posted: 22 Aug 2014 15:42
by highend
In a recursive way (start = current folder):

Code: Select all

text inputselect(".exe files", formatlist(folderreport("files", "r", "<curpath>", "r", , "<crlf>"), "f", "<crlf>", "*.exe", "f"), "<crlf>");

Re: can i get folder Contents in a drop list

Posted: 22 Aug 2014 15:50
by yusef88
Thanks for the quick response.. the idea that i can run program directly and the folder path is d:\tools

Re: can i get folder Contents in a drop list

Posted: 22 Aug 2014 16:08
by highend
Then just replace "text" with "run"...

Re: can i get folder Contents in a drop list

Posted: 22 Aug 2014 17:21
by yusef88
works great, sorry my last request i need to add .lnk to filter

Re: can i get folder Contents in a drop list

Posted: 22 Aug 2014 18:10
by bdeshi
Look, just try to work out what the script does, and consult the help file, and you can add lnk files yourself.
You asked for listing exe files, So the script has to filter some list by *.exe somewhere. And which part of the script seems related?
Read thru the script, the formatlist(...) command has *.exe as it's fourth parameter.

Code: Select all

text inputselect(".exe files", formatlist(folderreport("files", "r", "<curpath>", "r", , "<crlf>"), "f", "<crlf>", "*.exe", "f"), "<crlf>");
//look here:                   formatlist(    --------------- first parameter ----------------    , "f", "<crlf>", "*.exe"     )             
To list lnk files too, you probably need to add *.lnk to this somehow. But how?
Okay, now read about formatlist() in the scripting help, what do you discover about it?
That the f switch/format (shown above) means "filter".

And that when f formatting switch is used, the fourth parameter is used to filter the passed list.
And that multiple filters can be defined using a separator, and this separator is 3rd parameter of formatlist().
the manual about the fourth pararmter wrote:"On format f: A list of filters, separated by separator (3rd argument)."[/i]
Right, what's the 3rd parameter of formatlist in the script? it's the parameter left of "*.exe": <crlf>.
Well then, try to add *.lnk to *.exe, separated by <crlf>.
"*.exe<crlf>*.lnk"
that's it!

HTH.

Re: can i get folder Contents in a drop list

Posted: 22 Aug 2014 18:28
by highend
To make things a bit easier, switch to "|" as the separator:

Code: Select all

run inputselect(".exe files", formatlist(folderreport("files", "r", "<curpath>", "r", , "|"), "f", , "*.exe|*.lnk", "f"));

Re: can i get folder Contents in a drop list

Posted: 22 Aug 2014 20:46
by yusef88
grateful for the lesson and script :oops: