从 GUI 粘贴 AutoHotKey 符号的问题
Issues with AutoHotKey symbol pasting from GUI
我是 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 和 ListBox
但是当我选择并按下提交时没有粘贴符号。
此外,除了等待一秒钟并希望用户当时选择该字段之外,是否有更好的方法来检测是否选择了文本字段?
; 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
有关详细信息,请参阅文档中的 GUI。
我是 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 和 ListBox
但是当我选择并按下提交时没有粘贴符号。
此外,除了等待一秒钟并希望用户当时选择该字段之外,是否有更好的方法来检测是否选择了文本字段?
; 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
有关详细信息,请参阅文档中的 GUI。