AutoItWinSetTitle
修改 AutoIt 窗口标题.
AutoItWinSetTitle ( "newtitle" )
参数
返回值
None.
备注
AutoIt 窗口通常处于隐藏状态. 修改其标题的目的是为了让其它程序(或者其它 AutoIt 脚本程序)能与 AutoIt 交互.
相关
AutoItWinGetTitle, WinSetTitle
函数示例
示例 1
; Check if the script is already running
; Note: The recommended approach is to use _Singleton from Misc.au3
#include <MsgBoxConstants.au3>
Local $sMyAutoItTitle = "ThisIsSomeUniqueStringThatOtherWindowsWontHave"
If WinExists($sMyAutoItTitle) Then
; The script is already running
MsgBox($MB_SYSTEMMODAL, Default, "The script is already running." & @CRLF & @CRLF & _
"It's PID is: " & WinGetProcess($sMyAutoItTitle))
Else
; This is the first instance of the script.
; Set the autoit window title
AutoItWinSetTitle($sMyAutoItTitle)
; Run this script again.
If @Compiled Then
Run('"' & @ScriptFullPath & '"')
Else
Run('"' & @AutoItExe & '" "' & @ScriptFullPath & '"')
EndIf
MsgBox($MB_SYSTEMMODAL, Default, "This is the first instance." & @CRLF & @CRLF & _
"My PID is: " & @AutoItPID)
EndIf
示例 2
#include <GUIConstantsEx.au3>
Example()
Func Example()
; Set the title of the AutoIt Hidden Window.
AutoItWinSetTitle("My AutoIt Window")
; Display AutoIt's Hidden Window.
AutoItWinShow()
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd
EndFunc ;==>Example
; Display AutoIt's Hidden Window. Returns the handle of the window.
Func AutoItWinShow()
Local $hWnd = WinGetHandle(AutoItWinGetTitle()) ; Get the handle of the AutoIt Hidden Window by finding out the title of the AutoIt Hidden Window.
WinMove($hWnd, "", (@DesktopWidth / 2) - 250, (@DesktopHeight / 2) - 250, 500, 500) ; Move the AutoIt Hidden Window and re-size for a better view.
WinSetState($hWnd, "", @SW_SHOW) ; Show the AutoIt Hidden Window, normally this is hidden, but in the interest of this example I"m displaying it.
Return $hWnd
EndFunc ;==>AutoItWinShow
----------------------------------------
|