Jump to content

Wait untill object exist


Recommended Posts

Okay, the code is

Opt("WinTitleMatchMode", 2)
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Include <FF.au3>
global $clr
global $file
global $times
global $clr2
global $x
Local $x ;
$i = 0
$x = 0
$r = 0
$t = 0
While $i <= 10
Do
if not ProcessExists("HMA! Pro VPN.exe") Then
run("C:\Program Files\HMA! Pro VPN\bin\HMA! Pro VPN.exe")
endif
Until $x = 1


WEnd

when it start it open the software then i'll mouseclick command to click connect buttom, but after sucess connection there isnt any way to detect when it connected, i mean titles not changing after sucessfully connection, so i want to make it detect by text, because when Hma sucess connected there is text on it: Succesfully connected to VPN

Link to comment
Share on other sites

Connect to your VPN

run this code from scite and post results here.

Opt("WinTitleMatchMode", 2)
Opt("WinDetectHiddenText",1)

$_WinList = WinList("[CLASS:HMA! Pro VPN 2.7.1.7]")
If Not IsArray($_WinList) Then Exit MsgBox(0,0,0)
For $i = 1 To $_WinList[0][0]
    ConsoleWrite(WinGetText($_WinList[$i][1]) & @CRLF & @CRLF)
Next

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'm asking if you tried anything else besides

"[CLASS:HMA! Pro VPN 2.7.1.7]"

In

$_WinList = WinList("[CLASS:HMA! Pro VPN 2.7.1.7]")

Within the above code?

Edited by JohnOne

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

  • Moderators

Then we suggest you do so. We try to stick to the "teach a man to fish" model, rather than spoon-feeding you code. Why not try something on your own, and then come back if and when you run into a roadblock?

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

I have automated the starting of a VPN, and decided that the way to see connection state is to look at the tooltip on the tray icon. Here is example code that looks at all the tray tooltips. (Assuming that your VPN also shows connection state in tooltip.)

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