FileSelectFile() : Supports multi-line filter

Post your working scripts, libraries and tools
Peaceful
Posts: 25
Joined: 20 Mar 2017, 06:28

Re: FileSelectFile() : Supports multi-line filter

29 Sep 2020, 21:34

same as foobar2000 and Media Player

foobar2000 screenshot:
Image

So many apps are this style.
That's perfect.
User avatar
SKAN
Posts: 853
Joined: 29 Sep 2013, 16:58

Re: FileSelectFile() : Supports multi-line filter

30 Sep 2020, 03:58

gwarble wrote:
29 Sep 2020, 14:53
Thanks

Well I wouldn't want you to put an ugly trick in your elegant function, but if you came up with one I'd probably use it, as we treat no extension just like any other extension usually driven by the machine tool's software and/or interface (ethernet or memory card) requirements. Its surely not desperately needed as I've gotten by without it for this long :)
I've been trying hard.. No joy.. yet. :(

If I was in such situation, I might work around as follows
1) make a list of files without extension
2) create a temp folder
3) create shortcuts for each file.
4) show dialog for the temp folder
5) delete temp folder after dialog is dismissed.

But instead of all this trouble, It would be better to create a custom TreeView based UI :(
User avatar
SKAN
Posts: 853
Joined: 29 Sep 2013, 16:58

FileSelectFile() : v0.72

30 Sep 2020, 04:02

Code updated:

0.72A_LastError will contain the index of selected Filter. (Valid only if ErrorLevel is 0)

 
Demo script:
 

Code: Select all

#NoEnv
#SingleInstance, Force

Filter := "|Run with AutoHotkeyA32.exe (*.ahk)|Run with AutoHotkeyU32.exe (*.ahk)||Run with AutoHotkeyU64.exe (*.ahk)"
Selection := ["AutoHotkeyA32.exe", "AutoHotkeyU32.exe", "AutoHotkeyU64.exe"]

File := FileSelectFile( 1,,"Select script & interpreter", Filter)
If ! (ErrorLevel)
   MsgBox,,User choice, % "Run`n" . File . "`nwith`n" . Selection[A_LastError]

; Paste FileSelectFile() below
 
Image
gwarble
Posts: 461
Joined: 30 Sep 2013, 15:01

Re: FileSelectFile() : Supports multi-line filter

30 Sep 2020, 14:20

SKAN wrote:
30 Sep 2020, 03:58
But instead of all this trouble, It would be better to create a custom TreeView based UI :(
Thanks for looking in to it...

using different directories and shortcuts would be too cumbersome and problematic of a solution but I like the creative thinking... because most of the files we deal with are either named in the format "O1234" or "O2345 (COMMENT)" and your filtering allows for more than just extensions, I'm starting with something like:

All Documents (*.*)|NC Code (*0;*1;*2;*3;*4;*5;*6;*7;*8;*9;*)*)|AutoHotkey (*.ahk)|Heidenhein (*.H)

Which catches all files that end with a number or a right-parenthesis.
EitherMouse - Multiple mice, individual settings . . . . www.EitherMouse.com . . . . forum . . . .
User avatar
SKAN
Posts: 853
Joined: 29 Sep 2013, 16:58

Re: FileSelectFile() : Supports multi-line filter

30 Sep 2020, 15:12

gwarble wrote:
30 Sep 2020, 14:20
All Documents (*.*)|NC Code (*0;*1;*2;*3;*4;*5;*6;*7;*8;*9;*)*)|AutoHotkey (*.ahk)|Heidenhein (*.H)
Nice! But if I make copies of files in explorer, the file copies end with Copy (2) .. Copy(3) and so on.
I just realized the extensions cannot have open parenthesis in it, as I split the filter line at the last occurring (.
gwarble
Posts: 461
Joined: 30 Sep 2013, 15:01

Re: FileSelectFile() : Supports multi-line filter

30 Sep 2020, 15:35

ah yes that explains why "*)" wasn't working without that last *
EitherMouse - Multiple mice, individual settings . . . . www.EitherMouse.com . . . . forum . . . .

Return to “Scripts and Functions”

Who is online

Users browsing this forum: hasantr and 19 guests