Jump to content

Read ListBox Text


Recommended Posts

Hello guy, can you lead me on how to read the "Done!" Stat please thanks.

 

image.thumb.png.f5bc8b95253a7024914bae037c4ed73b.png

My Actual code for this partion.

; Script Start - Add your code below here
#include <Constants.au3>
#include <Array.au3>

#RequireAdmin

            ShellExecute ( "SslvpnClient.exe","","\\*******\********$\VPN\Client lourd Fortigate\sslvpnclient64" )
            Sleep (500)
               If ProcessExists ( "SslvpnClient.exe" ) Then
               $cHNW1 = WinWait ( "FortiClient SSLVPN Installer" )
               WinActivate ( $cHNW1 )
               WinMove ( $cHNW1 , "" , 0 , 0 )
               Endif
            $cUACDefaut = RegRead ( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" , "ConsentPromptBehaviorAdmin" )
            RegWrite ( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System","ConsentPromptBehaviorAdmin" , "REG_DWORD" , "0" )
            ControlClick ( "FortiClient" , "" , "[CLASS:Button; INSTANCE:4]" , "left" , 1 );Run admin
            Sleep ( 10000 )
            If WinExists ("FortiClient SSLVPN Installer") Then
               $cHNW2 = WinActivate ("FortiClient SSLVPN Installer")
               WinMove ( $cHNW2 , "" , 0 , 0 )
            EndIf
            ControlClick ( $cHNW2 , "" , "[CLASS:Button; INSTANCE:1]" , "left" , 1 );Install
            $cPixel = "0"
            Sleep (1000)
 ;HERE IS DONE
 ;HERE IS DONE
 ;HERE IS DONE
;~          ControlClick ( $cHNW2 , "" , "[CLASS:Button; INSTANCE:2]" , "left" , 1 ) ;Close

 

Edited by caramen

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

@caramen

  • ControlGetHandle() to retrieve the handle of the ListBox;
  • _GUICtrlListBox_GetCount() to retrieve the count of the items in the ListBox;
  • _GUICtrlGetText() to get the text of the item ( looped in a For...Next...Step loop, using the value returned from _GUICtrlListBox_GetCount().
Cheers :)

Click here to see my signature:

Spoiler

ALWAYS GOOD TO READ:

 

Link to comment
Share on other sites

Trying this after my cigare**e :P 

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

@FrancescoDiMuro Tyou mate like always you leaded me correctly. 

 

But i got one or two questions... 

 

I reduced the snipet code. to : 

If WinExists ("FortiClient SSLVPN Installer") Then
               $cHNW2 = WinActivate ("FortiClient SSLVPN Installer")
               WinMove ( $cHNW2 , "" , 0 , 0 )
            EndIf
;~          ControlClick ( $cHNW2 , "" , "[CLASS:Button; INSTANCE:1]" , "left" , 1 );Install

            $cControlIDForti = ControlGetHandle($cHNW2, "" , "[CLASS:ListBox; INSTANCE:1]")
            MsgBox (0,"",$cControlIDForti)
            $cControlIDFortiCount = _GUICtrlListBox_GetCount($cControlIDForti)
            MsgBox (0,"",$cControlIDFortiCount)
            $cFortiDoneStat= _GUICtrlGetText($cControlIDFortiCount)
            MsgBox (0,"",$cFortiDoneStat)

With an existing finished windows of forti client. 

I can have my script work by checking until i have 54 counts and i ll be OK with that but i am questionning my mind on how to go further. 

MsgBox (0,"",$cControlIDFortiCount) Return 54 so i understand my value Done! is at the line 54  But how can i check that since 

$cFortiDoneStat= _GUICtrlGetText($cControlIDFortiCount) ;Return noting 
            MsgBox (0,"",$cFortiDoneStat)
            
            $cFortiDoneStat= _GUICtrlGetText($cControlIDFortiCount[54]) ;Return noting 
            MsgBox (0,"",$cFortiDoneStat)
            
            
            ;Unfortunatly i dont have the error checking console becose of #RequireAdmin and cant try without it.

 

Edited by caramen

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

_GUICtrlGetTex

==> Unknown function name.:

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

This is what i got actualy. I guess you was confused with _GUI_GetText and ControlGetText

So i am trying... 

 

; Script Start - Add your code below here
#include <Constants.au3>
#include <Array.au3>
#include <GuiListBox.au3>
#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>

#RequireAdmin

;~          ShellExecute ( "SslvpnClient.exe","","\\******\******$\VPN\Client lourd Fortigate\sslvpnclient64" )
;~          Sleep (500)
;~             If ProcessExists ( "SslvpnClient.exe" ) Then
;~             $cHNW1 = WinWait ( "FortiClient SSLVPN Installer" )
;~             WinActivate ( $cHNW1 )
;~             WinMove ( $cHNW1 , "" , 0 , 0 )
;~             Endif
;~          $cUACDefaut = RegRead ( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" , "ConsentPromptBehaviorAdmin" )
;~          RegWrite ( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System","ConsentPromptBehaviorAdmin" , "REG_DWORD" , "0" )
;~          ControlClick ( "FortiClient" , "" , "[CLASS:Button; INSTANCE:4]" , "left" , 1 );Run admin
;~          Sleep ( 10000 )
            If WinExists ("FortiClient SSLVPN Installer") Then
               $cHNW2 = WinActivate ("FortiClient SSLVPN Installer")
               WinMove ( $cHNW2 , "" , 0 , 0 )
            EndIf
;~          ControlClick ( $cHNW2 , "" , "[CLASS:Button; INSTANCE:1]" , "left" , 1 );Install

            $cControlIDForti = ControlGetHandle($cHNW2, "" , "[CLASS:ListBox; INSTANCE:1]") ; Return expected handle 0x000000000004043E
            $cControlIDFortiCount = _GUICtrlListBox_GetCount($cControlIDForti) ; Return 54 lines
            MsgBox (0,"",$cControlIDFortiCount); MsgBox : 54

            ;$cFortiDoneStat = ControlGetText($cHNW2,"", $cControlIDForti[30] ) ;??????? HERE I AM STUCKING
            $cFortiDoneStat = ControlGetText($cHNW2,"", $cControlIDForti ) ;??????? HERE I AM STUCKING

            _ArrayDisplay ($cFortiDoneStat)
            MsgBox (0,"",$cFortiDoneStat) ; Return : ""

;~          ControlClick ( $cHNW2 , "" , "[CLASS:Button; INSTANCE:2]" , "left" , 1 ) ;Close

 

Edited by caramen

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

@caramen
Once you have the handle of the ListBox, why don't you use _GUICtrlListBox_GetText as I've already suggested to you?

$cControlIDForti = ControlGetHandle($cHNW2, "" , "[CLASS:ListBox; INSTANCE:1]")
 MsgBox (0,"",$cControlIDForti) ; Handle of the ListBox
 $cControlIDFortiCount = _GUICtrlListBox_GetCount($cControlIDForti) ; Items count in the ListBox
 MsgBox (0,"",$cControlIDFortiCount)
 ; $cFortiDoneStat= _GUICtrlGetText($cControlIDFortiCount) ; _GUICtrlGetText, a function that you may dreamed?
                                                           ; Taking a text from a number? What the ?!
For $i = 1 To $ControlIDFortiCount
    ConsoleWrite("Item " & $i & " text is '" & _GUICtrlListBox_GetText($cControlIDForti, $i) & "'." & @CRLF)
Next

Try it and let us know.

Edited by FrancescoDiMuro

Click here to see my signature:

Spoiler

ALWAYS GOOD TO READ:

 

Link to comment
Share on other sites

Damn it i did not see that one ! 

 

haha since it s not in the post :P :lol:

Edited by caramen

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

Working like a charm, solved! 

 

Thanks

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

I used it maybe 15 times for that thread :) 

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

I fall into a dark problem :P 

 

My reproducer is working... I copy past into my script it s not working anymore. I am not exiting that loop. For unknow reason.

 

And as you can see i added array security to be sure... 

 

Do
               $cControlIDFortiCount = _GUICtrlListBox_GetCount($cControlIDForti)
               $cFortiDoneStat0 = _GUICtrlListBox_GetText($cControlIDForti, $cControlIDFortiCount)
               $cFortiDoneStat1 = _GUICtrlListBox_GetText($cControlIDForti, $cControlIDFortiCount-1)
               $cFortiDoneStat2 = _GUICtrlListBox_GetText($cControlIDForti, $cControlIDFortiCount-2)
;~              MsgBox (0,"",$cFortiDoneStat)
               Sleep (2500)
            Until $cFortiDoneStat0 = "Done!" Or $cFortiDoneStat1 = "Done!" Or $cFortiDoneStat2 = "Done!"

 

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

Na na it s ok ... The difficult thing is to dev without a console to say me what's going on. 

 

It was a include forget since i added your function sorry.

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

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...