单击按钮直到进度条为 100%

Click Button Until Progress Bar is 100%

我正在使用 AutoIt 在程序中打开的所有 windows 上单击 Sim(葡萄牙语是),代码如下:

#requireAdmin
ShellExecute("...\Desktop\test.xrt")

While True
    $win = WinWait("XP-Remote", "Sim")
    ControlClick($win, "", "[CLASS:Button; INSTANCE:1]")
    WinWaitClose($win)
Wend

但是,我想在进度条100%的时候停止。

Autoit 信息

这是柱的数据:

而可见文本仅显示:

>>>> Window <<<<
Title:  Communicating...
Class:  #32770
Position:   623, 338
Size:   429, 135
Style:  0x94C800CC
ExStyle:    0x00010101
Handle: 0x00000000000B08CE

>>>> Control <<<<
Class:  msctls_progress32
Instance:   1
ClassnameNN:    msctls_progress321
Name:   
Advanced (Class):   [CLASS:msctls_progress32; INSTANCE:1]
ID: 1012
Text:   
Position:   11, 52
Size:   402, 29
ControlClick Coords:    151, 22
Style:  0x50000000
ExStyle:    0x00000004
Handle: 0x00000000003306DC

>>>> Mouse <<<<
Position:   788, 437
Cursor ID:  0
Color:  0xFFFFFF

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<
Elasped time:
00:14
Reading project files...


>>>> Hidden Text <<<<

使用定时器

我正在使用计时器,因为我不知道该怎么做。

#requireAdmin
ShellExecute("...\Desktop\test.xrt")
$Timer = TimerInit ()
Do
    $win = WinWait("XP-Remote", "Sim")
    ControlClick($win, "", "[CLASS:Button; INSTANCE:1]")
    WinWaitClose($win)
until TimerDiff($Timer)>=5000

不过,使用进度条更容易出错。

如何检查进度条或直到它 < 100%?

编辑:尝试使用:

可能不正确...

编辑:

使用此代码:

ShellExecute("...\Desktop\test.xrt")
 While True
$handle = ControlGetHandle ("Communicating...", "", "[CLASS:msctls_progress32; INSTANCE:1]")
ConsoleWrite("Progress bar handle: " & $handle & @CRLF)

$msg = _SendMessage($handle,$PBM_GETPOS,0,0)
ConsoleWrite("Position: " & $msg & "%" & @CRLF)
WEnd

结果是无限的:

Progress bar handle: 0x00000000
Position: 0%

_SendMessage($handle,$PBM_GETPOS,0,0) 正确。

这应该有效:

#include <SendMessage.au3>
#include <ProgressConstants.au3>

$hWnd = WinWait("Communicating...")
$hWnd_Progress = ControlGetHandle($hWnd,"","msctls_progress321")
While _SendMessage($hWnd_Progress,$PBM_GETPOS,0,0) < 100
    $win = WinWait("XP-Remote", "Sim")
    ControlClick($win, "", "[CLASS:Button; INSTANCE:1]")
    WinWaitClose($win)
WEnd