Jump to content
Sign in to follow this  
Panacea

Ping Script

Recommended Posts

Panacea

Hello,

I am new and exploring, Auto it, i was by some examples able to write a simple program, but i need some little understanding

Here is script

Send("#r")

WinWaitActive("Run")

Send("cmd.exe{Enter}")

WinWaitActive("")

Local $begin=TimerInit()

Send("ping 4.2.2.2 -t{Enter}")

sleep(3000)

Local $dif=TimerDiff($begin)

Send("^C")

I originally did not have WinWaitActive("")and i would get ng 4.2.2.2 -t and of course disaster, but i wanted to know why, this occured, i run a Vista Machine, is it due to the fact that my operating system is slow.

One more question, when i do not close this window, and i run the script again, the sleep function seems to be passive, any reason.

Thanks

Share this post


Link to post
Share on other sites
johnmcloud

From the help:

Local $var = Ping("www.AutoItScript.com", 250)
If $var Then; also possible:  If @error = 0 Then ...
    MsgBox(0, "Status", "Online, roundtrip was:" & $var)
Else
    MsgBox(0, "Status", "An error occured with number: " & @error)
EndIf

And also you can use Run for call directly cmd and the parameter without using Sleep, WinWait etc.

Share this post


Link to post
Share on other sites
Panacea

Thank you very much for the reply. I am a newbie so everything exites me. So i was think how i can open a file and then and see the laptop do it, my purpose was only not to run a ping :) . But in either case, could you tell me any place where i can find a keywords for this like it did not no ping existed. .

Thanks

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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.