Jump to content

FileOpenDialog() opposite filter


maqleod
 Share

Recommended Posts

is there a way to set the filter on FileOpenDialog() to filter out what you list rather than the default?

For example, I want the dialog to see all file types except .exe, .bat, .com and .pif

rather than list all other possible types, can I just list those in a different manner to exclude them?

[u]You can download my projects at:[/u] Pulsar Software
Link to comment
Share on other sites

There isn't a solution that I am aware of. You will just have to list them all or make your own gui.

It seems to me that this should be an option for fileopendialog(), like something you can add to the filters section with the NOT keyword to exclude file types. Oh well, i suppose i could just give an error message if an executable is selected.

[u]You can download my projects at:[/u] Pulsar Software
Link to comment
Share on other sites

It seems to me that this should be an option for fileopendialog(), like something you can add to the filters section with the NOT keyword to exclude file types. Oh well, i suppose i could just give an error message if an executable is selected.

It can be done something like this:

Func FileOpenDialogEx($TITLE,$INIT,$EXCEPTION,$OPTIONS)
    Local $ERROR = False
    Local $FILE = FileOpenDialog($TITLE,$INIT,"All (*.*)",$OPTIONS)
    Local $EXT = StringRight($FILE,StringLen($FILE)-StringInStr($FILE,".",0,-1)+1)
    For $INDEX = 0 To UBound($EXCEPTION)-1
        If $EXCEPTION[$INDEX] = $EXT Then
            $ERROR = True
            ExitLoop
        EndIf
    Next
    If $ERROR Then
        Return "EXCEPTION"
    Else
        Return $FILE
    EndIf
EndFunc

Dim $EXE[4] = [".exe",".bat",".com",".pif"]
MsgBox(0,"",FileOpenDialogEx("SELECT",@ScriptDir,$EXE,1))
Edited by Andreik

When the words fail... music speaks.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...