Jump to content
Sign in to follow this  
Dejan

net wait dc

Recommended Posts

Dejan

i have searched the help file and found that how can i check if the net is active or not. but how can i wait for it to be dc?

my script is very simple as

#NoTrayIcon
Opt("WinTitleMatchMode", 2)
While 1
    Sleep(1000)
    $var = Ping("www.google.com",250)
    If $var Then; also possible:  If @error = 0 Then ...
        WinSetState("ZTEConnect", "", @SW_HIDE)
    EndIf
WEnd

i want that after hiding the window script should wait for net to be disconnected. i am very new please help me.


[font="Comic Sans MS"]In Barishon se dosti acchi nahin Faraz, Kaccha tera makan hai kucch to khayal Ker.[/font]

Share this post


Link to post
Share on other sites
Dejan

* Dump * it have passed more then 24hrs but no one have replied.


[font="Comic Sans MS"]In Barishon se dosti acchi nahin Faraz, Kaccha tera makan hai kucch to khayal Ker.[/font]

Share this post


Link to post
Share on other sites
Airwolf

i have searched the help file and found that how can i check if the net is active or not. but how can i wait for it to be dc?

my script is very simple as

#NoTrayIcon
Opt("WinTitleMatchMode", 2)
While 1
    Sleep(1000)
    $var = Ping("www.google.com",250)
    If $var Then; also possible:  If @error = 0 Then ...
        WinSetState("ZTEConnect", "", @SW_HIDE)
    EndIf
WEnd

i want that after hiding the window script should wait for net to be disconnected. i am very new please help me.

Not the way I would go about checking for a disconnection, but here's a simple mod to your script.

#NoTrayIcon
Opt("WinTitleMatchMode", 2)
While 1
    Sleep(1000)
    If Ping("www.google.com",250) Then
        WinSetState("ZTEConnect", "", @SW_HIDE)
        ExitLoop
    EndIf
WEnd
While 1
    If Ping("www.google.com",250) = 0 Then
       ;do whatever it is you want to do after disconnected
    EndIf
    Sleep(250)
WEnd

Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt

Share this post


Link to post
Share on other sites
monoceres

Hi!

Maybe this:

#NoTrayIcon
Opt("WinTitleMatchMode", 2)
While 1
    Sleep(1000)
    $var = Ping("www.google.com", 250)
    If $var Then; also possible:  If @error = 0 Then ...
        WinSetState("ZTEConnect", "", @SW_HIDE)
        Do
            Sleep(250)
        Until Not Ping("www.google.com")
    EndIf
WEnd
Edited by monoceres

Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites
Dejan

@ Airwolf

@ monocers

hey thanks to both of you. did not checked yet but i hope it will work. thanks again.


[font="Comic Sans MS"]In Barishon se dosti acchi nahin Faraz, Kaccha tera makan hai kucch to khayal Ker.[/font]

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  

×