快速输入文字片段
Gui, Add, Text,r10, Alt+1:
Gui, Add, Text,r10, Alt+2:
Gui, Add, Text,r10, Alt+3:
Gui, Add, Edit, r10 vAlt1 w500 ym
Gui, Add, Edit, r10 vAlt2 w500
Gui, Add, Edit, r10 vAlt3 w500
Gui, Add, Text,x580 y10 w40 r10, Alt+4:
Gui, Add, Text,r10 , Alt+5:
Gui, Add, Text,r10 , Alt+6:
Gui, Add, Edit, r10 vAlt4 w500 ym
Gui, Add, Edit, r10 vAlt5 w500
Gui, Add, Edit, r10 vAlt6 w500
FileRead, FileAlt1, %A_ScriptDir%listAlt1.txt
FileRead, FileAlt2, %A_ScriptDir%listAlt2.txt
FileRead, FileAlt3, %A_ScriptDir%listAlt3.txt
FileRead, FileAlt4, %A_ScriptDir%listAlt4.txt
FileRead, FileAlt5, %A_ScriptDir%listAlt5.txt
FileRead, FileAlt6, %A_ScriptDir%listAlt6.txt
GuiControl,, Alt1, %FileAlt1%
GuiControl,, Alt2, %FileAlt2%
GuiControl,, Alt3, %FileAlt3%
GuiControl,, Alt4, %FileAlt4%
GuiControl,, Alt5, %FileAlt5%
GuiControl,, Alt6, %FileAlt6%
Gui, Add, Button, x400 w100, 保存
Gui, Add, Text, x600 y466 ,提示: Alt+Q显示窗口
GuiControl, Focus, 保存
Gui, Show
return ; 自动运行段结束. 在用户进行操作前脚本会一直保持空闲状态.
^s::
Button保存:
Gui, Submit ; 保存用户的输入到每个控件的关联变量中.
FileEncoding UTF-8
IfNotExist, %A_ScriptDir%list
FileCreateDir, %A_ScriptDir%list
FileDelete, %A_ScriptDir%listAlt1.txt
FileAppend, %Alt1%, %A_ScriptDir%listAlt1.txt
FileDelete, %A_ScriptDir%listAlt2.txt
FileAppend, %Alt2%, %A_ScriptDir%listAlt2.txt
FileDelete, %A_ScriptDir%listAlt3.txt
FileAppend, %Alt3%, %A_ScriptDir%listAlt3.txt
FileDelete, %A_ScriptDir%listAlt4.txt
FileAppend, %Alt4%, %A_ScriptDir%listAlt4.txt
FileDelete, %A_ScriptDir%listAlt5.txt
FileAppend, %Alt5%, %A_ScriptDir%listAlt5.txt
FileDelete, %A_ScriptDir%listAlt6.txt
FileAppend, %Alt6%, %A_ScriptDir%listAlt6.txt
;MsgBox You entered "%Alt1% %Alt2%".
Gui, Hide ;隐藏窗口会清空控件对应变量
GuiEscape:
GuiClose:
Gui, Hide
return
!q::
;从文件重新载入
FileRead, FileAlt1, %A_ScriptDir%listAlt1.txt
FileRead, FileAlt2, %A_ScriptDir%listAlt2.txt
FileRead, FileAlt3, %A_ScriptDir%listAlt3.txt
FileRead, FileAlt4, %A_ScriptDir%listAlt4.txt
FileRead, FileAlt5, %A_ScriptDir%listAlt5.txt
FileRead, FileAlt6, %A_ScriptDir%listAlt6.txt
GuiControl,, Alt1, %FileAlt1%
GuiControl,, Alt2, %FileAlt2%
GuiControl,, Alt3, %FileAlt3%
GuiControl,, Alt4, %FileAlt4%
GuiControl,, Alt5, %FileAlt5%
GuiControl,, Alt6, %FileAlt6%
Gui, Show
return
!1::
SendInput %tmp1%
return
!2::
SendInput %tmp2%
return
!3::
SendInput %tmp3%
return
!4::
SendInput %tmp4%
return
!5::
SendInput %tmp5%
return
!6::
SendInput %tmp6%
return