can i get folder Contents in a drop list

Discuss and share scripts and script files...
Post Reply
yusef88
Posts: 1148
Joined: 28 Jan 2013 03:50
Location: Windows 8.1 32-bit

can i get folder Contents in a drop list

Post by yusef88 »

can i get folder Contents in a drop list and filter them by .exe

highend
Posts: 14940
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: can i get folder Contents in a drop list

Post 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>");
One of my scripts helped you out? Please donate via Paypal

yusef88
Posts: 1148
Joined: 28 Jan 2013 03:50
Location: Windows 8.1 32-bit

Re: can i get folder Contents in a drop list

Post by yusef88 »

Thanks for the quick response.. the idea that i can run program directly and the folder path is d:\tools
To see the attached files, you need to log into the forum.

highend
Posts: 14940
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: can i get folder Contents in a drop list

Post by highend »

Then just replace "text" with "run"...
One of my scripts helped you out? Please donate via Paypal

yusef88
Posts: 1148
Joined: 28 Jan 2013 03:50
Location: Windows 8.1 32-bit

Re: can i get folder Contents in a drop list

Post by yusef88 »

works great, sorry my last request i need to add .lnk to filter

bdeshi
Posts: 4256
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612
Contact:

Re: can i get folder Contents in a drop list

Post 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.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

highend
Posts: 14940
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: can i get folder Contents in a drop list

Post 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"));
One of my scripts helped you out? Please donate via Paypal

yusef88
Posts: 1148
Joined: 28 Jan 2013 03:50
Location: Windows 8.1 32-bit

Re: can i get folder Contents in a drop list

Post by yusef88 »

grateful for the lesson and script :oops:

Post Reply