Autohotkey 从GUI粘贴自动热键符号的问题

Autohotkey 从GUI粘贴自动热键符号的问题,autohotkey,Autohotkey,我是AHK的新手,我正在尝试制作一个脚本,该脚本打开一个GUI,其中包含可以选择的常用符号的简短列表,然后自动粘贴 到目前为止,我的代码是: !+q:: Gui, Add, ListBox, w100 h100, vSymbolChoice, ™|©|°|π|☭|☢|⚠|ツ|•|Ω Gui, Add, Button, Default, Submit Gui, Add, Button, default, Cancel Gui, Show return ButtonSubmit: Gui, S

我是AHK的新手,我正在尝试制作一个脚本,该脚本打开一个GUI,其中包含可以选择的常用符号的简短列表,然后自动粘贴

到目前为止,我的代码是:

!+q::
Gui, Add, ListBox, w100 h100, vSymbolChoice, ™|©|°|π|☭|☢|⚠|ツ|•|Ω
Gui, Add, Button, Default, Submit 
Gui, Add, Button, default, Cancel
Gui, Show
return 

ButtonSubmit:
Gui, Submit
Sleep, 1000
Send, %SymbolChoice%
Gui, Destroy

ButtonCancel: 
Gui, Destroy
它创建GUI和
列表框
,但在选择符号并按submit时不会粘贴符号

此外,是否有更好的方法来检测是否选择了文本字段,而不是仅仅等待一秒钟并希望用户在该时间选择该字段

; auto-execute section
; create and show the Gui
Gui, Add, ListBox, w100 h130 vSymbolChoice, ™|©|°|π|☭|☢|⚠|ツ|•|Ω
Gui, Add, Button, Default, Submit
Gui, Add, Button,, Hide ; you can't have two default buttons on a Gui
Gui, Show
return

; Press Alt+Shift+Q to show the hidden Gui after ButtonSubmit or ButtonHide
!+q:: Gui, Show 

ButtonSubmit:
GuiControlGet, SymbolChoice ; get the control's contents stored in the variable SymbolChoice (retrieves the ListBox's current selection)
Gui, Submit ; saves the contents of this control to its associated variable SymbolChoice
SendInput, %SymbolChoice%
return

; Hide the Gui
ButtonHide: 
Gui, hide
return

; Press ESC or close the Gui to terminate the script
GuiClose:
Esc:: ExitApp
有关详细信息,请参阅文档。

有关检测焦点更改的信息,请参阅。但也许你想解释一下你到底想做什么?然后我可能会写一个正确的答案。