Jump to content

Wait for internet connection

Recommended Posts


how can i wait for internet then i want to continue my script
My code is

If not @error Then
WinActivate ( "XYZ")
ControlClick ( "XYZ", "", "[NAME:btnSave]")
ControlSend ( "XYZ", "", "[NAME:btnSave]", "{enter}")
WinWait("Number Entry")
ControlClick("Number Entry", "", "[NAME:btnNext]")
If WinExists ("Length Check") Then
   ControlClick("Length Check", "", "[CLASS:Button; INSTANCE:1]")
   ControlSend("Number Entry", "", "[NAME:txtNumber]", "{backspace}")
   ControlSend("Number Entry", "", "[NAME:txtNumber]", "^v")
   ControlClick("Number Entry", "", "[NAME:btnNext]")
   ControlClick("Verification", "", "[NAME:btnClose]")
   RunWait("rasdial /disconnect", "", @SW_HIDE) ; Stop connect from start
   RunWait("rasdial Internet", "", @SW_HIDE) ; Connect again
;wait for internet, after connected
MouseClick( "", 299, 228, 1, 1)

Its possible ??

Share this post

Link to post
Share on other sites

Yes, https://www.autoitscript.com/autoit3/docs/functions/Ping.htm

#include <MsgBoxConstants.au3>


Func Example()
    ; Ping the AutoIt website with a timeout of 250ms.
    Local $iPing = Ping("autoitscript.com", 250)

    If $iPing Then ; If a value greater than 0 was returned then display the following message.
        MsgBox($MB_SYSTEMMODAL, "", "The roundtrip-time took: " & $iPing & "ms.")
        MsgBox($MB_SYSTEMMODAL, "", "An error occurred with @error value of: " & @error)
EndFunc   ;==>Example


Share this post

Link to post
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