Sign in to follow this  
Followers 0
Komawoyo

Filter Drag and Drop

5 posts in this topic

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

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

#3 ·  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"

Share this post


Link to post
Share on other sites

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

great tip thx man

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  
Followers 0