Jump to content

WinGetText("[ACTIVE]") function


Recommended Posts

Can you post your code ?

Spoiler

My Contributions

Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language.

UDF Link Viewer   --- A tool to visit the links of some most important UDFs 

 Includer_2  ----- A tool to type the #include statement automatically 

 Digits To Date  ----- date from 3 integer values

PrintList ----- prints arrays into console for testing.

 Alert  ------ An alternative for MsgBox 

 MousePosition ------- A simple tooltip display of mouse position

GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function

Access_UDF  -------- An UDF for working with access database files. (.*accdb only)

 

Link to comment
Share on other sites

I use only one executable to test the script

#RequireAdmin
$sUserName = @UserName
Local $aArray[1]
$aArray[0] = "Brush.exe"
For $vElement In $aArray
Run($vElement)
WinWait("Seleziona la lingua dell'installazione")
WinActivate("Seleziona la lingua dell'installazione")
ControlClick("Seleziona la lingua dell'installazione", "", "Button1")
WinWait("Installazione di CyberLink", "InstallShield Wizard per CyberLink", 10)
Local $sTitle = WinGetTitle("[ACTIVE]")
if "Installazione di  in corso ..." = $sTitle then
   WinWait("Installazione di  in corso", "InstallShield Wizard per CyberLink")
   WinActivate("Installazione di  in corso", "InstallShield Wizard per CyberLink")
   ControlClick("Installazione di  in corso", "", "Button1")
   WinWaitActive("Installazione di  in corso", "Contratto di Licenza per l'Utente")
   ControlClick("Installazione di  in corso", "", "Button2")
   Sleep(2000)
   Local $sText = WinGetText("[ACTIVE]")
   Local $aSplit = StringSplit($sText, '\n')
    For $i = 1 To $aSplit[0]
        if $aSplit[$i] = "Informazioni sul cliente" then
            If WinActivate("Installazione di  in corso", "Informazioni sul cliente") Then
                ControlClick("Installazione di  in corso", "", "Button2")
            Else
                ConsoleWrite("The window is not activated")
            Endif
            WinWaitActive("Installazione di  in corso", "Cartella di destinazione")
            ControlClick("Installazione di  in corso", "", "Button1")
            WinWaitActive("Installazione di  in corso", "L'installazione aggiungerà le icone dei programmi")
            ControlClick("Installazione di  in corso", "", "Button2")
            WinWaitActive("Installazione di  in corso", "Il Setup ha completato l'installazione CyberLink")
            ControlClick("Installazione di  in corso", "", "Button4")
            else
            WinWaitActive("Installazione di  in corso", "Cartella di destinazione")
            ControlClick("Installazione di  in corso", "", "Button1")
            WinWaitActive("Installazione di  in corso", "L'installazione aggiungerà le icone dei programmi")
            ControlClick("Installazione di  in corso", "", "Button2")
            WinWaitActive("Installazione di  in corso", "Il Setup ha completato l'installazione CyberLink")
            ControlClick("Installazione di  in corso", "", "Button4")
        EndIf
    Next
Else
   WinWait("Installazione di CyberLink", "InstallShield Wizard per CyberLink")
   WinActivate("Installazione di CyberLink", "InstallShield Wizard per CyberLink")
   ControlClick("Installazione di CyberLink", "", "Button1")
   WinWaitActive("Installazione di CyberLink", "Contratto di Licenza per l'Utente")
   ControlClick("Installazione di CyberLink", "", "Button2")
   Sleep(2000)
   Local $sText = WinGetText("[ACTIVE]")
   Local $aSplit = StringSplit($sText, '\n')
    For $i = 1 To $aSplit[0]
        if $aSplit[$i] = "Informazioni sul cliente" then
            If WinActivate("Installazione di CyberLink", "Informazioni sul cliente") Then
                ControlClick("Installazione di CyberLink", "", "Button2")
            Else
                ConsoleWrite("The window is not activated")
            Endif
            WinWaitActive("Installazione di CyberLink", "Cartella di destinazione")
            ControlClick("Installazione di CyberLink", "", "Button1")
            WinWaitActive("Installazione di CyberLink", "L'installazione aggiungerà le icone dei programmi")
            ControlClick("Installazione di CyberLink", "", "Button2")
            WinWaitActive("Installazione di CyberLink", "Il Setup ha completato l'installazione CyberLink")
            ControlClick("Installazione di CyberLink", "", "Button4")
            else
            WinWaitActive("Installazione di CyberLink", "Cartella di destinazione")
            ControlClick("Installazione di CyberLink", "", "Button1")
            WinWaitActive("Installazione di CyberLink", "L'installazione aggiungerà le icone dei programmi")
            ControlClick("Installazione di CyberLink", "", "Button2")
            WinWaitActive("Installazione di CyberLink", "Il Setup ha completato l'installazione CyberLink")
            ControlClick("Installazione di CyberLink", "", "Button4")
        EndIf
    Next
EndIf
Next

 

Link to comment
Share on other sites

I installed the executable brush.exe (PowerDirector title template) with an autoit script but to do so I removed

Local $sText = WinGetText("[ACTIVE]")
   Local $aSplit = StringSplit($sText, '\n')
    For $i = 1 To $aSplit[0]
        if $aSplit[$i] = "Informazioni sul cliente" then

  function.

So, imho, the elements are correctly recognized

Edited by trof
Link to comment
Share on other sites

5 hours ago, trof said:

Nothing

Then the line...

if $aSplit[$i] = "Informazioni sul cliente" then

...will never be reached, because $aSplit[0] == ""

Back to the drawing board and investigate what WinGetText is actually returning.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

trof, did you tried with @CRLF instead of "\n" ?

Spoiler

My Contributions

Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language.

UDF Link Viewer   --- A tool to visit the links of some most important UDFs 

 Includer_2  ----- A tool to type the #include statement automatically 

 Digits To Date  ----- date from 3 integer values

PrintList ----- prints arrays into console for testing.

 Alert  ------ An alternative for MsgBox 

 MousePosition ------- A simple tooltip display of mouse position

GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function

Access_UDF  -------- An UDF for working with access database files. (.*accdb only)

 

Link to comment
Share on other sites

Are you sure that your array $aSplit is populated properly ?. 

Spoiler

My Contributions

Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language.

UDF Link Viewer   --- A tool to visit the links of some most important UDFs 

 Includer_2  ----- A tool to type the #include statement automatically 

 Digits To Date  ----- date from 3 integer values

PrintList ----- prints arrays into console for testing.

 Alert  ------ An alternative for MsgBox 

 MousePosition ------- A simple tooltip display of mouse position

GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function

Access_UDF  -------- An UDF for working with access database files. (.*accdb only)

 

Link to comment
Share on other sites

No I'm not.

I tried another function taken from autoit help

Local $sText = WinGetText("[ACTIVE]")
   Local $aArray = StringSplit($sText, @CRLF)
    For $i = 1 To $aArray[0] ; Loop through the array returned by StringSplit to display the individual values.
        MsgBox($MB_SYSTEMMODAL, "", "$aArray[" & $i & "] - " & $aArray[$i])

The array is blank.

Here the result

Img_31_07_2016_20_08_23.jpg

Link to comment
Share on other sites

If you are not sure then you need to check that.

Spoiler

My Contributions

Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language.

UDF Link Viewer   --- A tool to visit the links of some most important UDFs 

 Includer_2  ----- A tool to type the #include statement automatically 

 Digits To Date  ----- date from 3 integer values

PrintList ----- prints arrays into console for testing.

 Alert  ------ An alternative for MsgBox 

 MousePosition ------- A simple tooltip display of mouse position

GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function

Access_UDF  -------- An UDF for working with access database files. (.*accdb only)

 

Link to comment
Share on other sites

I tried this simple script to investigate the array output

#RequireAdmin
#include <MsgBoxConstants.au3>
#include <StringConstants.au3>
Example()

Func Example()
   Run("Brush.exe")
   Sleep(3000)
   Local $sText = WinGetText("[ACTIVE]")
   Local $aArray = StringSplit($sText, @CRLF)
   For $i = 1 To $aArray[0] ; Loop through the array returned by StringSplit to display the individual values.
     MsgBox($MB_SYSTEMMODAL, "", "$aArray[" & $i & "] - " & $aArray[$i])
    Next
EndFunc   ;==>Example

The result is multiple instances of popup. Every time I click OK it appears another popup until are showed all the phrases of Visible Text.

Is there a way to show all phrases of the Visible Text in a single popup?

 

 

 

Link to comment
Share on other sites

Try this if it is a testing purpose

#RequireAdmin
#include <MsgBoxConstants.au3>
#include <StringConstants.au3>
#include <Array.au3>

Example()

Func Example()
 Run("Brush.exe")
 Sleep(3000)
 Local $sText = WinGetText("[ACTIVE]")
 Local $aArray = StringSplit($sText, @CRLF)
 _ArrayDisplay($aArray)
EndFunc  ;==>Example

 

Spoiler

My Contributions

Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language.

UDF Link Viewer   --- A tool to visit the links of some most important UDFs 

 Includer_2  ----- A tool to type the #include statement automatically 

 Digits To Date  ----- date from 3 integer values

PrintList ----- prints arrays into console for testing.

 Alert  ------ An alternative for MsgBox 

 MousePosition ------- A simple tooltip display of mouse position

GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function

Access_UDF  -------- An UDF for working with access database files. (.*accdb only)

 

Link to comment
Share on other sites

Your output is

Img_31_07_2016_21_24_16.jpg

 

I tried this in my script (not the test one)

Local $sText = WinGetText("[ACTIVE]")
   Local $aArray = StringSplit($sText, @CRLF, $STR_ENTIRESPLIT)
    For $i = 1 To $aArray[0] ; Loop through the array returned by StringSplit to display the individual values.
        MsgBox($MB_SYSTEMMODAL, "", "$aArray[" & $i & "] - " & $aArray[$i]

and the output is

Img_31_07_2016_21_23_36.jpg

 

when I write 

Local $sText = WinGetText("[ACTIVE]")
   Local $aArray = StringSplit($sText, @CRLF)
    For $i = 1 To $aArray[0] ; Loop through the array returned by StringSplit to display the individual values.
        MsgBox($MB_SYSTEMMODAL, "", "$aArray[" & $i & "] - " & $aArray[$i]

the output is one only popup

Img_31_07_2016_21_29_30.jpg

 

It should be a popup for every phrase of the Visible Test, as it happened in my test script.

Maybe this is the issue

Link to comment
Share on other sites

As per the code you should get atleast 10 msgboxs.  Just check what is the ubound of that array right after StringSplit statement. 

Spoiler

My Contributions

Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language.

UDF Link Viewer   --- A tool to visit the links of some most important UDFs 

 Includer_2  ----- A tool to type the #include statement automatically 

 Digits To Date  ----- date from 3 integer values

PrintList ----- prints arrays into console for testing.

 Alert  ------ An alternative for MsgBox 

 MousePosition ------- A simple tooltip display of mouse position

GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function

Access_UDF  -------- An UDF for working with access database files. (.*accdb only)

 

Link to comment
Share on other sites

17 minutes ago, kcvinu said:

As per the code you should get atleast 10 msgboxs.  Just check what is the ubound of that array right after StringSplit statement. 

Not if only one @cr is present.

Try...

StringSplit($sText, Chr(11)) ; vertical tab

 

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

I tried to get array dimensions with this

Local $sText = WinGetText("[ACTIVE]")
   Local $aArray = StringSplit($sText, @CRLF)
    For $i = 1 To $aArray[0] ; Loop through the array returned by StringSplit to display the individual values.
        UBound($aArray, $UBOUND_DIMENSIONS)
        MsgBox($MB_SYSTEMMODAL, "", "$aArray[" & $i & "] - " & $aArray[$i])

but the script closes himself without show any output.

I also tried many other combinations with no luck

Link to comment
Share on other sites

trof, Wrong,  not inside the loop.  Right after the string split and above the for loop.

And Ubound($aArray) is enough

Edited by kcvinu
Spoiler

My Contributions

Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language.

UDF Link Viewer   --- A tool to visit the links of some most important UDFs 

 Includer_2  ----- A tool to type the #include statement automatically 

 Digits To Date  ----- date from 3 integer values

PrintList ----- prints arrays into console for testing.

 Alert  ------ An alternative for MsgBox 

 MousePosition ------- A simple tooltip display of mouse position

GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function

Access_UDF  -------- An UDF for working with access database files. (.*accdb only)

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...