yair Posted May 19, 2010 Posted May 19, 2010 both input fileds are configured to accept file drops.the first works, the second doesn't replace data content but appends to it.#include <GUIConstantsEx.au3> #include <file.au3> #include <array.au3> $file1 = "test.jpg" $file2 = "test2.jpg" $Form1 = GUICreate("Form1", 625, 200, 192, 124, -1, 0x00000018); WS_EX_ACCEPTFILES $file1GUI = GUICtrlCreateInput($file1, 80, 70, 513, 21) GUICtrlSetState(-1, $GUI_DROPACCEPTED) $file2GUI = GUICtrlCreateInput($file2, 80, 118, 513, 21) GUICtrlSetState(-1, $GUI_DROPACCEPTED) GUISetState(@SW_SHOW) $msg = 0 While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() WEnd
water Posted May 19, 2010 Posted May 19, 2010 (edited) The only difference I see when I start your script is that the content of the first input field is marked and therefore replaced when dropping a file. The second input field isn't marked and therefore the dropped file is appended. Edited May 19, 2010 by water My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
yair Posted May 19, 2010 Author Posted May 19, 2010 ok, i didnt notice that. so i understand i need to change the focus to the second input filed when i drag. can you hint to how?
water Posted May 19, 2010 Posted May 19, 2010 (edited) To do it manually just tab to the second field.If you want to do it automatically then you'll have to catch the GUI event of drag&drop (example) Edited May 19, 2010 by water My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
yair Posted May 19, 2010 Author Posted May 19, 2010 thanks, this work#include <GUIConstantsEx.au3> $file1 = "test.jpg" $file2 = "test2.jpg" $Form1 = GUICreate("Form1", 625, 200, 192, 124, -1, 0x00000018); WS_EX_ACCEPTFILES $file1GUI = GUICtrlCreateInput($file1, 80, 70, 513, 21) GUICtrlSetState(-1, $GUI_DROPACCEPTED) $file2GUI = GUICtrlCreateInput($file2, 80, 118, 513, 21) GUICtrlSetState(-1, $GUI_DROPACCEPTED) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $msg = 0 While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $GUI_EVENT_DROPPED If (@GUI_DropId == 3) Then GUICtrlSetState($file1GUI, $GUI_FOCUS) GUICtrlSetData($file1GUI,@GUI_DRAGFILE) ElseIf (@GUI_DropId == 4) Then GUICtrlSetState($file2GUI, $GUI_FOCUS) GUICtrlSetData($file2GUI,@GUI_DRAGFILE) EndIf EndSelect WEndbtw, whats the easiest way to convert a control id from @GUI_DropId == 3@GUI_DropId == $file1GUI
water Posted May 19, 2010 Posted May 19, 2010 (edited) It's the same. @GUI_DropId = Control identifier where the drop occurred = the value (ControlId) returned by GUICtrlCreateInput. So the lineIf (@GUI_DropId == 3) Thencan be written asIf (@GUI_DropId == $file1GUI) Then Edited May 19, 2010 by water My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
yair Posted May 19, 2010 Author Posted May 19, 2010 thanks, the speed and quality of advice in au3 forums doesn't fail to amaze me.
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