Jump to content

Recommended Posts

Posted

I don't think there's a way of using filters, but you can do like this for example:

#include <GUIConstants.au3>
Opt("GuiOnEventMode",1)
GUICreate("Form1", 200, 63, 229, 170, -1, BitOR($WS_EX_ACCEPTFILES,$WS_EX_WINDOWEDGE))
$Input1 = GUICtrlCreateInput("Drag and drop a file here", 12, 18, 177, 21)
GUICtrlSetState(-1,$GUI_DROPACCEPTED)
GUISetState(@SW_SHOW)
GUISetOnEvent($GUI_EVENT_CLOSE,"_exit")
GUISetOnEvent($GUI_EVENT_DROPPED,"_Dropped")
While 1
    Sleep(25)
WEnd
Func _exit()
    Exit
EndFunc
Func _Dropped()
    If StringRight(@GUI_DragFile,3)<>"vbs" Then
        GUICtrlSetData($Input1,"Invalid File Type!")
        Sleep(700)
        GUICtrlSetData($Input1,"Drag and drop a file here")
    EndIf
EndFunc
Posted (edited)

The above doesn't work if the control is Edit.

Also @GUI_DRAGFILE doesn't support multiple files.

Tho maybe this thing was fixed since v3.2.4.9 which I'm still using, I don't know.

Anyway, you may also take a look at this, which doesn't suffer from the issues:

#412438

In any case, filtering must be done by you, like Nahuel said.

Edited by Siao

"be smart, drink your wine"

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
×
×
  • Create New...