QA Stooge Posted January 9, 2009 Share Posted January 9, 2009 (edited) As it stands, the canned input prompts like FileOpenDialog, FileSaveDialog, FileSelectFolder and InputBox, do not accept drag & drop from windows explorer. For example, if I have a "My Documents" window open, I cant drag a file from that window and drop it into the above prompts to populate it with the path&filename. Is there a setting somewhere to change this? Edited January 9, 2009 by QA Stooge Link to comment Share on other sites More sharing options...
FireFox Posted January 9, 2009 Share Posted January 9, 2009 @QA Stooge Why using drag for fileopendialog ? For drop files you can use little gui where you drop your file and then you ask user where to save the dropped file with fileselectfolder Cheers, FireFox. Link to comment Share on other sites More sharing options...
QA Stooge Posted January 15, 2009 Author Share Posted January 15, 2009 (edited) @QA StoogeWhy using drag for fileopendialog ? For drop files you can use little gui where you drop your file and then you ask user where to save the dropped file with fileselectfolder Cheers, FireFox.I was thinking more along the lines of a simple, generic, application.For example, I have one called XMLtidy, which I use to pretty up (for human readability) some ugly XML output, generated by a 3rd party XSLT engine. It would save time for me and my QA team to not have to copy & paste the folder path, when we can just drag & drop the file icon itself from an explorer window. Edited January 15, 2009 by QA Stooge Link to comment Share on other sites More sharing options...
P388l3s Posted February 3, 2009 Share Posted February 3, 2009 here's some code I've been working on for a similar app here at work, I've tidied it up a bit and left a great big pointer to where to put your code. expandcollapse popup#include <Constants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> Opt ( 'GUIOnEventMode', 1 ) Opt ( 'TrayOnEventMode',1 ) Opt ( 'TrayMenuMode', 3 ) TraySetClick ( 8 ) $Gui = GUICreate ( 'Drag Drop', 75, 30, -1, -1, -1, $WS_EX_ACCEPTFILES + $WS_EX_TOOLWINDOW ); + $WS_EX_APPWINDOW $GRP = GUICtrlCreateGroup ( 'Drop File', 2, 2, 71, 26 ) GUICtrlSetState ( $GRP, $GUI_DROPACCEPTED ) $TrayExit = TrayCreateItem ( 'Exit' ) TrayItemSetOnEvent ( $TrayExit, 'ExitEvent' ) GUISetState ( @SW_SHOW, $Gui ) Func _BringToFront ( ) If Not WinActive ( $Gui ) Then WinActivate ( $Gui ) EndIf EndFunc Func _GUI ( ) TraySetOnEvent ( $TRAY_EVENT_PRIMARYDOWN, '_BringToFront' ) GUISetOnEvent ( $GUI_EVENT_CLOSE, "SpecialEvents" ) GUISetOnEvent ( $GUI_EVENT_MINIMIZE, "SpecialEvents" ) GUISetOnEvent ( $GUI_EVENT_RESTORE, "SpecialEvents" ) GUISetOnEvent ( $GUI_EVENT_DROPPED, '_dropped' ) While 1 Sleep ( 10 ) WEnd EndFunc Func SpecialEvents ( ) Select Case @GUI_CtrlId = $GUI_EVENT_CLOSE ExitEvent ( ) EndSelect EndFunc ;==>SpecialEvents Func ExitEvent ( ) Exit EndFunc Func _dropped ( ) ;@GUI_DRAGID, @GUI_DRAGFILE and @GUI_DROPID ;MsgBox ( 4096 + 64, 'Output', @GUI_DRAGFILE ) If FileExists ( @GUI_DRAGFILE ) Then #cs YOUR CODE GOES HERE!!! #ce Else ;Redundant test. EndIf EndFunc _GUI ( ) Just remember @GUI_DRAGFILE is your actual filename to work with. If you left click the tray icon it brings the window to the front, a right click gives you a menu (exit only) and you should be set from there. Hope this helps. Pebbles. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now