Jump to content
Sign in to follow this  
Komawoyo

Filter Drag and Drop

Recommended Posts

Komawoyo

is there a way to Let only certain file to be process when drag and dropping? Vb Scripts (*.vbs)

Share this post


Link to post
Share on other sites
Nahuel

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

Share this post


Link to post
Share on other sites
Siao

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"

Share this post


Link to post
Share on other sites
Nahuel

Well yeah, it was just an example. What I meant is that he should do the filtering job.

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.