Sign in to follow this  
Followers 0
WikiView

more trouble

8 posts in this topic

#1 ·  Posted (edited)

so far i got this;

AutoItSetOption("TrayIconHide", 1)
Sleep(1000)
call("mainloop")


func mainloop()
        $var = ping("www.google.dk", 5000)
            if $var Then
                sleep(10000)
                call("mainloop")
            Else
                    call("loopster")
            EndIf
EndFunc

func loopster()
    $i = 0
    $kald = ping("www.google.dk", 1000)
    Do
                    ToolTip("u got 30 sec or else ur comp is gonna reboot")
                    if $kald then
                        tooltip("")
                        call("mainloop")
                    Else
                        sleep(1000)
                        $i = $i + 1
                    EndIf
    until $i = 30 
    shutdown(5)
                    
                
EndFunc

the problem is that it doesnt call the main loop and it just keeps idling untill it reboots..

is it just me or ? :lmao:

Edited by WikiView

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

First problem are the recursive function calls. The program will crash sooner or later due to stack overflow.

Here is a script that does the same, but without recursive calls:

AutoItSetOption("TrayIconHide", 1)
Sleep(1000)

While ping("www.google.dk", 5000)
  Sleep(10000)
Wend

For $i = 1 to 30
  ToolTip("u got 30 sec or else ur comp is gonna reboot")
  Sleep(1000)
Next
shutdown(5)
Edited by Froed

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

hmm... so if you're experience a glitch in the network connection your computer is going to be restarted...

I guess all companies should have that function :lmao:

Edited by jinxter

> there are 10 types of people in the world, those who understand binary and those who don't.

Share this post


Link to post
Share on other sites

First problem are the recursive function calls. The program will crash sooner or later due to stack overflow.

Here is a script that does the same, but without recursive calls:

AutoItSetOption("TrayIconHide", 1)
Sleep(1000)

While ping("www.google.dk", 5000)
  Sleep(10000)
Wend

For $i = 1 to 30
  ToolTip("u got 30 sec or else ur comp is gonna reboot")
  Sleep(1000)
Next
shutdown(5)
well i need to program to call the pinging again when they plug in network cable.

so far if it cant ping its just gonna reboot :lmao:

Share this post


Link to post
Share on other sites

I should say... using a program with shutdown is a pretty wild idea, I would go for a simple msgbox() stating that the computer will shut down, at least until it works as intended.

but... it feels that this program will shutdown after it triggers the for/next statement regardless of the ping status... better glue that rj-45 to the port ,eh ? :lmao:


> there are 10 types of people in the world, those who understand binary and those who don't.

Share this post


Link to post
Share on other sites

I should say... using a program with shutdown is a pretty wild idea, I would go for a simple msgbox() stating that the computer will shut down, at least until it works as intended.

but... it feels that this program will shutdown after it triggers the for/next statement regardless of the ping status... better glue that rj-45 to the port ,eh ? :lmao:

hehe ya.

thats why i want it so u can plug the RJ-45 again and it goes back to pinging our server (and not google as intended)

Share this post


Link to post
Share on other sites

just out of curiosity....

what is this program used for ?


> there are 10 types of people in the world, those who understand binary and those who don't.

Share this post


Link to post
Share on other sites

just out of curiosity....

what is this program used for ?

im working as a admin in a technical education center in denmark.

we got kids from 8th grade running around here, and they should be learning stuff but are playing instead.

the leadership dont want a firewall on, and they want us to monitor the certain students that play flashgames in their spare time.

but these kids download the flashgame and pull their network plug (cant say they arent smart) so we cant take screenshots of them playing.

so pretty much i want to make a program that pings our server so when they pull the plug they got a timer on setting the plug back in or it reboots.

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  
Followers 0