如何调用WinWait静默安装向导支持多国语言?

How to invoke WinWait for silent installation of wizard to support multiple languages?

我正在使用 winetricks 执行向导的静默安装,我得到了以下运行良好的代码(基于 previous version of installer):

w_ahk_do "
    Run, ${file1}
    WinWait, MetaTrader 5 Setup
    ControlClick, Button1
    Sleep 100
    ControlClick, Button3
    WinWait, MetaTrader 5 Setup, Installation successfully completed
    ControlClick, Button4
    Process, Wait, terminal.exe
    Process, Close, terminal.exe
"

然而,问题是当语言环境不同时它不起作用。

然后我必须根据语言相应地调整代码,例如波兰语版本看起来像:

w_ahk_do "
    Run, ${file1}
    WinWait, MetaTrader 5 Ustawienia
    ControlClick, Button1
    Sleep 100
    ControlClick, Button3
    WinWait, MetaTrader 5 Ustawienia, Instalacja ukończona
    ControlClick, Button4
    Process, Wait, terminal.exe
    Process, Close, terminal.exe
"

等等。

有什么方法可以防止为每种语言实现许多不同的代码(使用 WinWait 或类似的功能)?

    ; auto-execute section:
; GroupAdd, GroupName, WinTitle, WinText, Label, ExcludeTitle, ExcludeText

GroupAdd, MetaTrader_Setup_Group, MetaTrader 5 Setup,,,, Installation successfully completed
GroupAdd, MetaTrader_Setup_Group, MetaTrader 5 Ustawienia,,,, Instalacja ukończona

GroupAdd, MetaTrader_Setup_successfull_Group, MetaTrader 5 Setup, Installation successfully completed
GroupAdd, MetaTrader_Setup_successfull_Group, MetaTrader 5 Ustawienia, Instalacja ukończona

        Return  ; ênd of the auto-execute section

; All windowing commands can operate upon a window group by specifying ahk_group GroupName

w_ahk_do "
    Run, ${file1}
    WinWait, ahk_group MetaTrader_Setup_Group
    ControlClick, Button1
    Sleep 100
    ControlClick, Button3
    WinWait, ahk_group MetaTrader_Setup_successfull_Group
    ControlClick, Button4
    Process, Wait, terminal.exe
    Process, Close, terminal.exe
"

https://autohotkey.com/docs/commands/GroupAdd.htm


可以使用WinWait, ahk_class,例如

WinWait, ahk_class MetaQuotes::MetaTrader::4.00

要获取 AHK 的名称 class,可以使用 WindowSpy.ahk 脚本(AHK 附带)。