Scripting 如何将GuiDropFiles与GUI控件一起使用?
如何将Scripting 如何将GuiDropFiles与GUI控件一起使用?,scripting,autohotkey,Scripting,Autohotkey,如何将GuiDropFiles与GUI控件一起使用 我的表单中有几个edit字段,我希望能够将文件分别放到这些字段中并使用它们 这就是我想到的: 首先,我的控件设置如下: WS_EX_ACCEPTFILES=0x10 Gui, add, edit, vedit1, %file_1% WinSet,ExStyle, +WS_EX_ACCEPTFILES, edit1 我的拖放例程如下所示: GuiDropFiles: ; Support drag & drop. Loop,
GuiDropFiles
与GUI控件一起使用
我的表单中有几个edit
字段,我希望能够将文件分别放到这些字段中并使用它们
这就是我想到的:
首先,我的控件设置如下:
WS_EX_ACCEPTFILES=0x10
Gui, add, edit, vedit1, %file_1%
WinSet,ExStyle, +WS_EX_ACCEPTFILES, edit1
我的拖放例程如下所示:
GuiDropFiles: ; Support drag & drop.
Loop, parse, A_GuiControlEvent, `n
{
thisfile := a_loopfield ; Get the first file only (in case there's more than one).
thiscontrol := a_guicontrol
break
}
alert(thisfile . "`r" . thiscontrol)
if(thiscontrol = edit1)
guicontrol,,%edit1%, %thisfile%
if(thiscontrol = edit2)
guicontrol,,%edit2%, %thisfile%
if(thiscontrol = edit3)
guicontrol,,%edit3%, %thisfile%
return
我正在使用自动热键文档中的。我也试过了,但它不停地说,“不是掉在编辑框上的”。
任何线索都很好。找到了(在失去几个小时后)
首先,我不需要这个:WinSet,ExStyle,+WS\u EX\u ACCEPTFILES,edit1
我不需要在编辑控件上设置任何样式
我所需要的就是这个,因为我的编辑控件的变量名以“UI_file”开头:
GuiDropFiles: ; Support drag & drop.
Loop, parse, A_GuiEvent, `n
{
thisfile := A_LoopField ; Get the first file only (in case there's more than one).
thiscontrol := a_guicontrol
break
}
;alert(thisfile . "`r" . thiscontrol)
If InStr(A_GuiControl, "UI_file")
guicontrol,,%A_GuiControl%, %thisfile%
return