Wolfshare Posted March 7, 2013 Share Posted March 7, 2013 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 More sharing options...
jdelaney Posted March 7, 2013 Share Posted March 7, 2013 (edited) 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 March 7, 2013 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 More sharing options...
JohnOne Posted March 7, 2013 Share Posted March 7, 2013 I would use winwaitactive("title") but i cannot on my caseWhy not? 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 More sharing options...
Wolfshare Posted March 7, 2013 Author Share Posted March 7, 2013 Is there any examples? i would like to learn from examples. Link to comment Share on other sites More sharing options...
Wolfshare Posted March 7, 2013 Author Share Posted March 7, 2013 Why not?Because in my example after sucess connection title has not changed..I cannot set sleep(time) because sometimes it takes longer... Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted March 7, 2013 Moderators Share Posted March 7, 2013 Yes, look at the help file under WinGetHandle as suggested. There are examples there. "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 More sharing options...
Wolfshare Posted March 7, 2013 Author Share Posted March 7, 2013 Yes, look at the help file under WinGetHandle as suggested. There are examples there.Thanks, will look into it. Link to comment Share on other sites More sharing options...
Wolfshare Posted March 7, 2013 Author Share Posted March 7, 2013 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 More sharing options...
JohnOne Posted March 7, 2013 Share Posted March 7, 2013 Opt("WinTitleMatchMode", 2) $hWin = WinWaitActive("part of title") Do Sleep(1000) Until StringInStr(WinGetText($hWin), "Sucessfuly connected to VPN") MsgBox(0,0,"Yay") 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 More sharing options...
Wolfshare Posted March 7, 2013 Author Share Posted March 7, 2013 Just tried, does not work.. You can see, i need to make it wait untill this exist.. Link to comment Share on other sites More sharing options...
jdelaney Posted March 7, 2013 Share Posted March 7, 2013 (edited) 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 March 7, 2013 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 More sharing options...
Wolfshare Posted March 7, 2013 Author Share Posted March 7, 2013 I want to make it wait untill text exist, i mean sleep untill win exist, tried your script, but it's only showwing msg. Link to comment Share on other sites More sharing options...
Wolfshare Posted March 7, 2013 Author Share Posted March 7, 2013 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 More sharing options...
jdelaney Posted March 7, 2013 Share Posted March 7, 2013 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 More sharing options...
JohnOne Posted March 7, 2013 Share Posted March 7, 2013 Opt("WinDetectHiddenText",1) 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 More sharing options...
Wolfshare Posted March 11, 2013 Author Share Posted March 11, 2013 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 More sharing options...
JohnOne Posted March 11, 2013 Share Posted March 11, 2013 i have writed my script on other softwarePost the relevant code from "other software". 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 More sharing options...
Wolfshare Posted March 11, 2013 Author Share Posted March 11, 2013 sent via pm. Link to comment Share on other sites More sharing options...
Nessie Posted March 11, 2013 Share Posted March 11, 2013 sent via pm.Why not on the forum? So other people can help you? 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 More sharing options...
JohnOne Posted March 11, 2013 Share Posted March 11, 2013 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now