Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Automatically Shutdown Windows w/ Timer!
Index -> Programming, Turing -> Turing Submissions
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
the_short1




PostPosted: Mon Apr 24, 2006 2:50 pm   Post subject: 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 Wink

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


code:

%% 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]
Sponsor
Sponsor
Sponsor
sponsor
TokenHerbz




PostPosted: Mon Apr 24, 2006 3:07 pm   Post subject: (No subject)

cool stuff, i dont want to test it :S, but if it works, awsome...
Delos




PostPosted: Mon Apr 24, 2006 5:00 pm   Post subject: (No subject)

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




PostPosted: Tue Apr 25, 2006 5:49 pm   Post subject: (No subject)

great now all you have to do is add that to the startup folder Laughing
Clayton




PostPosted: Wed Apr 26, 2006 4:54 pm   Post subject: (No subject)

thats pretty cool, i didnt think turing was capable of something like this, and the thought that it is is pretty... weird gj
codemage




PostPosted: Thu Apr 27, 2006 8:59 am   Post subject: (No subject)

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




PostPosted: Thu Apr 27, 2006 1:35 pm   Post subject: (No subject)

haha I guess he has stillnot seen the post I madea long time ago in off-topic, hehe Laughing
md




PostPosted: Thu Apr 27, 2006 2:20 pm   Post subject: (No subject)

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...
Sponsor
Sponsor
Sponsor
sponsor
Thuged_Out_G




PostPosted: Wed May 03, 2006 12:09 am   Post subject: (No subject)

well, i have XP and no windows folder in my C: drive Razz

could you not use

code:

"%SystemRoot%\system32\shutdown.exe -s"
the_short1




PostPosted: Wed May 03, 2006 9:52 am   Post subject: (No subject)

Thuged_Out_G wrote:
could you not use
code:

"%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 Smile
md




PostPosted: Wed May 03, 2006 4:44 pm   Post subject: (No subject)

the_short1 wrote:
Being able to execute programs/command line is the power toy which makes turing fun Smile


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




PostPosted: Thu May 04, 2006 8:01 am   Post subject: (No subject)

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




PostPosted: Thu May 04, 2006 3:15 pm   Post subject: (No subject)

You can use windows scheduler if you dont want turing running alll the time.
aldreneo




PostPosted: Thu May 04, 2006 3:22 pm   Post subject: (No subject)

This program is a good example how to use Sys.Exec

Good job Very Happy
Clayton




PostPosted: Thu May 04, 2006 3:44 pm   Post subject: (No subject)

codemage wrote:
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
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 2  [ 16 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: