Sign in to follow this  
Followers 0
Psychotron

WinWaitActive for a window OR another window

7 posts in this topic

Hi,

I am trying to make a script for installing a program for italian and english operating systems.

I've used:

WinWaitActive("Seleziona la lingua dell'installazione")

It's ok on italian operating systems.

With english operating systems I should use:

WinWaitActive("choose setup language")

Is there a way to put two possibilities?

something like:

WinWaitActive("Seleziona la lingua dell'installazione" or "choose setup language")

Thanks in advance

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Something like this ?

Do
    $_WinWaitActive = WinWaitActive ( "Seleziona la lingua dell'installazione", "", 1 )
    $_WinWaitActive = WinWaitActive ( "choose setup language", "", 1 )
Until $_WinWaitActive <> 0
Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

Psychotron,

Welcome to the AutoIt forum. :huh2:

I would do something like this:

#include <GUIConstantsEx.au3>

$hGUI = GUICreate("Test", 500, 500)

$hButton_E = GUICtrlCreateButton("English",  10, 10, 80, 30)
$hButton_I = GUICtrlCreateButton("Italian", 100, 10, 80, 30)

GUISetState()

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $hButton_E
            GUICreate("choose setup language")
            GUISetState()
        Case $hButton_I
            GUICreate("Seleziona la lingua dell'installazione")
            GUISetState()
    EndSwitch

    If WinExists("choose setup language") Then
        WinWaitActive("choose setup language")
        MsgBox(0, "Active", "English version")
        ExitLoop
    ElseIf WinExists("Seleziona la lingua dell'installazione") Then
        WinWaitActive("Seleziona la lingua dell'installazione")
        MsgBox(0, "Active", "Italian version")
        ExitLoop
    EndIf

WEnd

All clear? ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Wow, it's possible to make also a gui! I have to do an unattended installation, but for other purposes that's very nice!

Thank you very much! I'll try your two solutions and let you know!

Edited by Psychotron

Share this post


Link to post
Share on other sites

Psychotron,

it's possible to make also a gui!

Of course! ;)

Might I suggest reading the Help file (at least the first few sections - Using AutoIt, Tutorials and the first couple of References) - this will help you enormously in your coding. You should also look at the excellent tutorials that you will find here and here - you will find other tutorials in the Wiki (the link is at the top of the page).

There are even video tutorials on YouTube if you prefer watching to reading.

Enjoy AutoIt. :huh2:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

If you want to go by the window text to know the language, then do it with the 1st window and do the rest of the install with the known language added to a variable $lang rather then trying to check for both languages through the whole script.

Example

Global $lang
For $i = 0 To 20
    If WinExists("Seleziona la lingua dell'installazione") Then
        $lang = 'italian'
        ExitLoop
    ElseIf WinExists('choose setup language')
        $lang = 'english'
        ExitLoop
    EndIf
    Sleep(250)
Next

If $lang = 'italian' Then
    ; progress with italian install code here
ElseIf $lang = 'english' Then
    ; progress with english install code here
Else
    ; lang error notification :(
EndIf

Share this post


Link to post
Share on other sites

Very smart.

Thank you!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0