Jump to content

Wait untill object exist


Recommended Posts

Hello everyone, i would like to know is that possible to make wait untill object will be active? I am talking not about win title, i am talking how to detect is that thing already active or not if there is no title on the software, or it has not been changing after some of actions.

It is very hard to explain, but i can show you example, there is VPN, after script connect to vpn, how they could kn ow that it's connected? if title has not changing after sucess connection?

I would use winwaitactive("title") but i cannot on my case.. Please help me with that :)

Link to comment
Share on other sites

Get the handle of the window (prior to connection), then use the handle to loop until the title changes (fails/succeeds to connect).

WinGetHandle...the handle of the window will never change, even when the title does

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

Hey just tried WinWait("[CLASS:HMA! Pro VPN 2.7.1.7]", "Sucessfuly connected to VPN", 50)

But unfortunaly not sucess.. I dont know how to make script wait untill text "Sucessfuly connected to VPN" exist.. tried to change class, which i got from Autoit info.. but still not working.

Link to comment
Share on other sites

Put the window info tool crosair over the static, copy all of the data from the 'Summary' tab, and paste back to the forum. If you get the handle of the window, and the handle of the static, you can probably use a loop of controlgettext until the data changes to what you need.

try this...let us know if you can get the text of the control

$hwnd = WinGetHandle("HMA! Pro")
If Not IsHWnd($hwnd) Then
 MsgBox(1,1,"not able to find the window" )
 Exit
EndIf
$hControl = ControlGetHandle ($hwnd, "", "[REGEXPCLASS:STATIC; INSTANCE:15]" )
If Not IsHWnd($hControl) Then
 MsgBox(1,1,"not able to find the control" )
 Exit
EndIf
MsgBox(1,1,ControlGetText($hwnd, "",$hControl ))
Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

Now my 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

then just want to wait it untill Sucessfuly connected to VPN exist.

Link to comment
Share on other sites

I wanted to make sure you are getting the control, first.

Then you can loop through until the text is as expected:

$timer = TimerInit()
$bFoundText = False
While TimerDiff($timer) < 20000
 If ControlGetText($hwnd, "",$hControl ) = "Succesfully connected to VPN" Then
  $bFoundText = True
  ExitLoop
 EndIf
WEnd
If $bFoundText Then
 MsgBox(1,1,"VPN connected within 20 seconds" )
Else
 MsgBox(1,1,"VPN NOT connected within 20 seconds" ) 
EndIf
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

Sorry folks, it's hard to understand, i was tired then, so now i really want to learn that, i have writed my script on other software, but now want to re-make it on this one :) but still cannot make that function work propertly, i would pay for help, if anyone could teach me how to make wait untill text exist on any software then continue work.. :)

Link to comment
Share on other sites

sent via pm.

Why not on the forum? So other people can help you? :P

Hi!

My UDF: NetInfo UDF Play with your network, check your download/upload speed and much more! YTAPI Easy to use YouTube API, now you can easy retrive all needed info from a video. NavInfo Check if a specific browser is installed and retrive other usefull information. YWeather Easy to use Yahoo Weather API, now you can easily retrive details about the weather in a specific region. No-IP UDF Easily update your no-ip hostname(s).

My Script: Wallpaper Changer Change you wallpaper dinamically, you can also download your wallpaper from your website and share it with all!   My Snippet: _ImageSaveToBMPConvert an image to bmp format. _SciteGOTO Open a file in SciTE at specific fileline. _FileToHex Show the hex code of a specified file

Link to comment
Share on other sites

Perhaps wires are crossed, I thought you meant you had written code in another language.

What you sent is just Autoit code which appears to wait until a window exists.

Also for future reference "post" means show in thread, not PM.

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

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