
-----------------------------------
the_short1
Mon Apr 24, 2006 2:50 pm

Automatically Shutdown Windows w/ Timer!
-----------------------------------
thought ide share this little chunk of code.

It will shutdown your computer at the time given in the two Constants 'Hour' and 'Minute'

my main purpose for this, is i start some Bit Torrent downloads on my personal pc in the morning, and i like my computer to turn off before my step mom gets home from work, so if she goes on the family computer, the internet isnt slow, and she doesnt need to go onto my computer.

but of course, it has malicious fun written all over it ;)

edit: the two shutdown commands can be made into a start menu shortcut, and add a custom keyboard shortcut to it, so with one combination of keys, you can shutdown your computer, without waiting for shutdown dialog box to come up!

IE: Ctrl + Alt + F4 , intsead of going to desktop, Alt + F4, wait, then Enter...

-kevin



%% programmed by kevin f. aka the_short1, sometime 2005
const Hour : int := 14 % hour, remember 24 hour clock
const Minute : int := 10 % minute
var wind : int := Window.Open ("graphics:400;50,position:top;right,nobuttonbar,title:ShutDown At: " + intstr (Hour) + ":" + intstr (Minute))
colorback (black)
cls
color (white)
var today : string
var ret : int
loop
    today := Time.Date
    View.Set ("title:" + "Time Left: Hours: " + intstr (Hour - strint (today (11 .. 12))) + " Minutes: " + intstr (Minute - strint (today (14 .. 15))))
    if strint (today (11 .. 12)) = Hour then % hour
        if strint (today (14 .. 15)) = Minute then % minute
            put "Shuting Down Computer, Please Wait"
            if not Sys.Exec ("C:\\WINDOWS\\system32\\shutdown.exe -s") then  %% winxp shutdown
                if not Sys.Exec ("C:\\WINDOWS\\RUNDLL.EXE user.exe,exitwindows") then %% win98 shutdown
                    put "Something Is Wrong, email short1@gmail.com"
                end if
            end if
            exit
        end if
    end if
    Time.Delay (15000)
end loop

[/code]

-----------------------------------
TokenHerbz
Mon Apr 24, 2006 3:07 pm


-----------------------------------
cool stuff, i dont want to test it :S, but if it works, awsome...

-----------------------------------
Delos
Mon Apr 24, 2006 5:00 pm


-----------------------------------
Interesting...I guess this wouldn't be too bad as long as no one was at the computer at the time.  On the other hand, have *any* Turing programme running is bound to slow things down at least a little...but that's mostly Turing's fault.

-----------------------------------
MysticVegeta
Tue Apr 25, 2006 5:49 pm


-----------------------------------
great now all you have to do is add that to the startup folder  :lol:

-----------------------------------
Clayton
Wed Apr 26, 2006 4:54 pm


-----------------------------------
thats pretty cool, i didnt think turing was capable of something like this, and the thought that it is is pretty... weird gj

-----------------------------------
codemage
Thu Apr 27, 2006 8:59 am


-----------------------------------
You wouldn't believe the some of the things that Turing is capable of doing.  It's limited in many aspects, yes, but it has a few power-toy functionalities of its own.

-----------------------------------
MysticVegeta
Thu Apr 27, 2006 1:35 pm


-----------------------------------
haha I guess he has stillnot seen the post I madea  long time ago in off-topic, hehe  :lol:

-----------------------------------
md
Thu Apr 27, 2006 2:20 pm


-----------------------------------
Technically it's just a timer program which calls another program when the timer runs out... nothing special about that. There is no turing "power toy" here, or really anywhere.

It is a nifty hack though... useless... but nifty...

-----------------------------------
Thuged_Out_G
Wed May 03, 2006 12:09 am


-----------------------------------
well, i have XP and no windows folder in my C: drive :P

could you not use


"%SystemRoot%\system32\shutdown.exe -s"


-----------------------------------
the_short1
Wed May 03, 2006 9:52 am


-----------------------------------
could you not use

"%SystemRoot%\system32\shutdown.exe -s"


I dont know, i never tried, but i will when i get a chance.

Being able to execute programs/command line is the power toy which makes turing fun :)

-----------------------------------
md
Wed May 03, 2006 4:44 pm


-----------------------------------
Being able to execute programs/command line is the power toy which makes turing fun :)

That's a power toy? Because almost every other language has a library that will let you do that too... infact it's pretty much required that they do in order to write some programs. Had turing lacked such an ability then it would be frightening; but that it doesn't is nothing to be happy for.

Like I said; it's an nifty hack for the fact that it does something semi-useful. But really it's not all that exciting.

-----------------------------------
codemage
Thu May 04, 2006 8:01 am


-----------------------------------
So our group consensus is:

A - Turing is not the program which you would use if you wanted to code an algorithm to run the world monetary fund, compute a solution for world peace, or discover what is the question of the universe, life & everything?  (To which we all pretty much know the exciting two-digit answer).

B - Turing has quite a bit of useability and clever features for a language that is crippled, dumbed down and sterilized for school use.

-----------------------------------
Neo
Thu May 04, 2006 3:15 pm


-----------------------------------
You can use windows scheduler if you dont want turing running alll the time.

-----------------------------------
aldreneo
Thu May 04, 2006 3:22 pm


-----------------------------------
This program is a good example how to use Sys.Exec

Good job :D

-----------------------------------
Clayton
Thu May 04, 2006 3:44 pm


-----------------------------------
So our group consensus is:

A - Turing is not the program which you would use if you wanted to code an algorithm to run the world monetary fund, compute a solution for world peace, or discover what is the question of the universe, life & everything?  (To which we all pretty much know the exciting two-digit answer).

B - Turing has quite a bit of useability and clever features for a language that is crippled, dumbed down and sterilized for school use.
that is more or less everything, but as a starter language (weve been over this many times) it can be good, and is able to do many things, even if they aren't practical (like run a timer to shut down your comp lol) but to each his own, so whatever

-----------------------------------
skootles
Thu May 04, 2006 8:04 pm


-----------------------------------
Very nice, except it'll default to wait an extra 30 seconds. Change it to
shutdown -s -t 00 
and it'll be instant. Plus, maybe you could add the comment option in the program, so like so if someone goes to the computer, they can read the little message. You most likely already know how, but just incase, it's:
shutdown -s -t xx -c MESSAGEHERE

But still, niiiice.   8-)
