[PA] 업무자동화/[AH]Autohotkey
AH GUI file drag and drop
Weneedu
2023. 3. 6. 06:34
2023.03.05
REF
[1] "; https://riptutorial.com/autohotkey/example/28159/open-a-file-through-windows-drag-n--drop"
drag and drop event를 잡는 부분은 GuiDropFiles이다.
Gui, add, edit, hwndxEdit, drop file here
Gui, add, button, gbtn_ok, &OK
Gui, add, button, x+0 gbtn_exit, &Exit
Gui, show, w200 h100, gui_Test
return
btn_ok:
return
btn_exit:
ExitApp
return
GuiDropFiles:
MouseGetPos,,,,Hdrop,2
if(Hdrop=xEdit)
MsgBox,% A_GuiEvent ;the names of the files that were dropped
Gui, show,,gui_Test
return
^ESC:: ExitApp
다음 코드와 비교해보자
Gui, XXXX: 은 Gui에 이름을 부여하는 것, 여러 GUI를 동시에 만든다면 이름이 필요하겠지..
Gui, XXXX: New
Gui, add, edit, hwndxEdit, drop file here
Gui, add, button, gbtn_ok, &OK
Gui, add, button, x+0 gbtn_exit, &Exit
Gui, show, w200 h100, gui_Test
return
btn_ok:
return
btn_exit:
ExitApp
return
XXXXGuiDropFiles:
MouseGetPos,,,,Hdrop,2
if(Hdrop=xEdit)
MsgBox,% A_GuiEvent ;the names of the files that were dropped
Gui, show,,gui_Test
return
^ESC:: ExitApp