Jump to content

Wait for internet connection


naru
 Share

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]")
   Send("{enter}")
   WinWait("Verification")
   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
WinActivate("PQRS")
Send("{enter}")
MouseClick( "", 299, 228, 1, 1)
   Exit
EndIf

Its possible ??

Link to comment
Share on other sites

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

#include <MsgBoxConstants.au3>

Example()

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.")
    Else
        MsgBox($MB_SYSTEMMODAL, "", "An error occurred with @error value of: " & @error)
    EndIf
EndFunc   ;==>Example

 

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