【发布时间】:2014-08-26 19:26:06
【问题描述】:
我们有一个 AutoIt 脚本来简化我们的流程。原版已经传出去了,大家都不敢删东西,所以我要从头重写。这个想法是成为一个“控制面板”来启动一些任务。我正在努力让它更小、更精简,以便我们的现场技术人员可以在平板电脑上使用它。
我想创建一些按钮,用于启动包含技术所需信息的单独窗口。问题是在生成时尝试关闭新窗口。我要打开第二个 GUI,但我无法关闭它。
我尝试了WinClose("title") 和WinKill("title") 的变体,但都不起作用。他们总是最终锁定整个脚本。我正在使用消息循环格式,但我愿意接受建议。我的代码:
#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>
#include <windowsConstants.au3>
#include <ColorConstants.au3>
;Button Declarations
Global $List
;GUI Creation
Opt('MustDeclarVars', 1) ;Creates an error message if a variable is used by not declared.
GUICreate("Tech Control Panel", 450, 530) ;Creates the GUI and it's elements.
GUISetState(@SW_SHOW)
;Button creation and location settings
;Left Column
GUICtrlCreateLabel("Tools", 10, 10, 100, 30, $SS_CENTER)
$List = GUICtrlCreateButton("Tech List", 10, 30, 100, 30)
;Main loop, gets GUI actions and processes them
While 1
$msg = GUIGetMsg()
Select
Case $msg = $TechList
GUICreate("List", 200, 300)
GUISetState(@SW_SHOW)
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_Event_Close
WinClose("List")
EndSelect
WEnd
Case $msg = $GUI_Event_Close
Exit
EndSelect
WEnd
【问题讨论】:
标签: user-interface autoit