loading
hey, thats another instructabel taken from my daily life...

last time i had to download lots of software to my PC and i had to let it download overnight, i didnt want to keep my PC turned on all night long after finishing the downloads and at the same time i couldnt stay awake to wait for it to finish the downloads and turn it off! therefore i made a VBscript that allows the PC to turn Off automatically in an interactive way !, i assign the minutes the PC will be turned on before shutting down according to how much time the downloads will take, i give it some little extra time to turn off after the time required for download in case there may be any decrease in speed but at least i wont stay awake nor i will keep my PC turned all night long doing nothing! and the PC in this case will be interactive with the user as i added to it some voice and narration too!
therefore watch my instructabel!

and if you like plz put a comment!
thanks

Step 1: Start by Writing the Script...


open notepad, and write the following script into notepad:

Dim x
Dim y

set oShell = createobject("wscript.shell")
Set Sapi = Wscript.CreateObject("SAPI.SpVoice")

x = InputBox("Would you like to shutdown your PC after a preiod of time? answer: yes/no","AUTOMATIC SYSTEM SHUTDOWN! by SCRIPTmaster")

if x = "yes" then
y = InputBox("Enter time left for shutdown to occur automatically(time in minutes...):","AUTOMATIC SYSTEM SHUTDOWN!")
sapi.speak y + "minutes left for shutdown"
oShell.Run "shutdown.exe -s -t " & (y * 60) & " -f -c ""System is now set for automatic shutdown! do not wait for the downloads to finish, you can go to sleep! GOOD NIGHT! see u 2morow! >>>>to terminate this Automatic shutdown just rerun the script and type no"""

end if
if x = "no" then
sapi.speak "okay, as you wish good bye, script writen by Ayman Farhat the SCRIPTmaster"
oShell.run "shutdown.exe -a"
end if

Step 2: Detailed Description of the Code in the Script...

Dim x and Dim y ///declare the variables x and y responsible for the answer and the time respectively.

set oShell = createobject("wscript.shell") /// calls the OS shell and creates the object wscript.shell

Set Sapi = Wscript.CreateObject("SAPI.SpVoice") ///calls the windows SAPI and creates the object SAPI.SpVoice which is responsible for the speech in this script as it narrates to the user...

x = InputBox("Would you like to shutdown your PC after a preiod of time? answer: yes/no","AUTOMATIC SYSTEM SHUTDOWN! " ///calls the input where the user says if he wants to shut down his PC

if x = "yes" then /// is a branching statement
y = InputBox("Enter time left for shutdown to occur automatically(time in minutes...):","AUTOMATIC SYSTEM SHUTDOWN!") // if the user chooses yes then he is promted by another input to asign the time left for shutdown
sapi.speak y + "minutes left for shutdown" ///the windows SAPI reads the minutes left

oShell.Run "shutdown.exe -s -t " & (y * 60) & " -f -c ""System is now set for automatic shutdown! do not wait for the downloads to finish, you can go to sleep! GOOD NIGHT! see u 2morow! >>>>to terminate this Automatic shutdown just rerun the script and type no""" ///this is the shutdown statement which calls the system shutdown executable to launch and shuts the PC according to the given time which is in this case the variable y!
end if //ends the first if statement which is in this case yes

if x = "no" then //.another is statement responsible for the no answer
sapi.speak "okay, as you wish good bye, script writen by Ayman Farhat the SCRIPTmaster" ///the SAPI speaks to the user and tells him good bye
oShell.run "shutdown.exe -a" / /the shutdown.exe is called in this case and is told not to perform the shutdown by adding -a !
end if // end of the if statement!

that was a breif yet detailed description, know go to the next step to see what to do...

Step 3: Saving Your Script

after you have entered your script to notepad you have to save it,
click save, and in the place where you type the name of your file put the name of your file followed .vbs as shown in the figure...

Step 4: Run Your Script...

double click on the VB program you just saved and see the magic!
you will be first prompted by an input askig you wether you want to shut down or not as show in the figure. if you do not choose to shut down by typing no the program will end automatically...
if you choose to shutdown by typing yes you will be prompted by another input asking the number of minutes you want your PC to stay turned on as shown in the figure below.
and then the shutdown countdown will start
if you want to end that shutdown for any reason just rerun the program while the shutdown is taking place and type no and it will terminate autonomously!

So that was a solution for a problem that a lot of PC users suffer from! hope you liked my instructable
if you do, please leave a comment i will be so pleased to hear from you.
GOOD LUCK and GOOD NIGHT!
I bow down before thee (I haven't tried it yet, though) but have been baffled for quite some time why the virus scan developers don't include a "do you want to shut down after scan is complete" thing. I mean DUH. You are my god now. Thanks!
<p>mcafee has it</p>
I am working on the website for the program that i told you about, i will finish it this week hopefully and the program will be available next week(the BETA version) and then i will be making release after release, each with bug fixes and new cool things! when everything is ready i will post the link here on the comments! ;)
thanks man! just wait a little and you will see the next version of this great program! i am almost done writing the program and i will make t available free for download in the coming weeks. The new one is much advanced! it has more options and has animations and its writen in java! once i upload the program to the net i will PM you! ;)
<p>Is it possible to use this to make it go to sleep or hibernate?</p>
<p>its too good...</p>
Doesn't the input box only return a string, not a number?
Great for when I'm likely to fall asleep watching a vid!! Thank you. (Can the program be amended to run without manually starting and to do the shutting down at the same time each day?)
&nbsp;I am&nbsp;glad&nbsp;i am just a little geek. because i don't understand anything of this.
&nbsp;hi , if you can not understand this take this easy program you can download it from &nbsp;here :<br /> http://versus.comlu.com/articles.html<br /> <br />
I meant&nbsp;more or less the&nbsp;script&nbsp;the program it self would&nbsp;probably&nbsp;be quite easy to use, but i don't&nbsp;believe&nbsp;i am able to use it whit vuze. And any way i don't have any use for it.
diddo
&nbsp;Nice job.
COOL COOL COOL
Thats some damn good script. You are a script master
create a shortcut on your desktop, go to his properties and in the &quot;target&quot; box type this <em>%windir%\system32\shutdown.exe -s -f -t 00</em> where 00 is the time till shutdown, and in the &quot;start in&quot; box type&quot; <em>%windir%</em>, so you dont have to type all that every time you want to schedule your pc for shutdown. you can also create a shortcut with the -r to stop the shutdown<br/>
some computers have so many locks that it doesn't work. Any advice???
what do you mean by locks?
restrictions
Try running as administrator.
i cant hack the username if u know PM me
Type this into notepad and save as <strong>net.bat</strong><br/><hr/>@echo off<br/>echo.<br/>net user Administrator *<br/>echo.<br/>echo You may now run as administrator using the password you typed. -2008 TAT Creator<br/>echo.<br/>echo Press any key to quit . . . &amp; pause &gt; nul<br/>
what does this do? does this change the administrator's password or what?
Exactly.
from a limited user? from a user that is not an admin?
Actually, on some systems you may have to have administrative authority, but being on an administrative account does not mean that you are the Administrator user. The Administrator user is hidden, however if you log in to Safemode you can see it.
no it allows you to set a timer for your PC for it to shutdown... read the title :P
i said PM me!!!!
it doesnt work.
First of all, when we post a batch code, we prefer to leave it to where the whole public can experience it and suggest ideas to edit it. Secondly:<br/>1: If you run the program, you are to type the password for Administrator in the space provided.<br/><br/>2: After you change the password, right-click the VBS program you are trying to run. Click Run As...<br/><br/>3: Click the bubble by Administrator. Type the password you changed in the space provided.<br/><br/>4: You <em>must</em> be logged in to your Admin level account if you wish for any of this to work. Contact official help and maintnence if you still wish to continue.<br/>
Would you teach us VBS syntax? We thought we would use it in the next edition of our <a rel="nofollow" href="https://www.instructables.com/id/tat_system">system</a>.<br/>
How are you doing on your work? We are interested in an update.
can you make it hibernate instead?
thank you so much for this - I ALWAYS wanted something like this, but I don't want to download some random program onto my computer. I am not a good coder, so this helped a lot. plus its pretty good for teaching some basic vbs tricks.
actually I did notice a problem - there is no popup displaying the time left and some text below. it shows the command prompt for a second, but its so fast I cant even tell what it says.
I tried it and got mad at you because it didnt work but i read a few more instructables like it and tried yours again slightly different and it worked! Awsom instructable P.S my spelling is bad and i am tired.
This is awesome. It is very helpful.
brilliant, mate. id like to see this in the program: if you already said yes to shutdown, then restarted the program, and said yes, itll let you enter a new time. this second time wont count. perhaps the program should go like this if you already initiated a shutdown sequence: if yes and initiated, then comment "sequence already initiated. end shutdown by restarting and typing no" something to that effect :) awesome job tho !
you are 100% right man, actually i havent updated this script since 3 months or so, actually right now i am working on a similar yet advanced program writen in java and that has the features you are talking about and much more! :) it is ready but i just want to upload it online to have it free for download, once everything is ready i will post the link here! ;)
nice i hope its done soon. and the script for the java will be doubly nice ;]
sick. ill check it out.
hi can u make one for hibernate and thanks for this splendid piece of scripting
Its incredible!!!!!!!!!! I have always been looking for something like this so i can go to sleep listening to music without worry. THANX
thanks for the comment, just wait until you see my next version, free for download, i am writing it in java and it has much more cooler features!
Brilliant! I love it! My wife & I have wanted something to shut down the pc automatically for ages. Well done, kudos to you!
To Exit this without re-running the script, just go to the run in your start menu or press the windows key on your keyboard and "r" at the same time, and it opens. Then in this: "Shutdown -a" And after that it will close that box. To start this shutdown using this method, type: "shutdown -s -t XX -c COMMENT" Replace XX with the amount of time you want it to wait, in seconds and replace COMMENT with what comment you want. Of course -t and -c are completely optional. And there are heaps more tags like -m for example which can shut down a remote computer on a network or even over the net if your smart like me :)
yup, thats true, thanks for the tip! i should have put that in the instructable above!
can u make it skip the yes/no part?
yeah of course!, here is the code for that, just put it instead the one provided in the instructable above and it will skip the yes/no part!<br/><br/>Dim y<br/>set oShell = createobject(&quot;wscript.shell&quot;)<br/> Set Sapi = Wscript.CreateObject(&quot;SAPI.SpVoice&quot;) <br/> y = InputBox(&quot;Enter time left for shutdown to occur automatically(time in minutes...):&quot;,&quot;AUTOMATIC SYSTEM SHUTDOWN!&quot;)<br/> sapi.speak y + &quot;minutes left for shutdown&quot;<br/>oShell.Run &quot;shutdown.exe -s -t &quot; &amp; (y * 60) &amp; &quot; -f -c &quot;&quot;System is now set for automatic shutdown! do not wait for the downloads to finish, you can go to sleep! GOOD NIGHT! see u 2morow! &gt;&gt;&gt;&gt;to terminate this Automatic shutdown just rerun the script and type no&quot;&quot;&quot;<br/><br/>'hope you like it, have fun ;)<br/>
VBS can be executed by a website, correct?

About This Instructable

38,762views

24favorites

License:

More by SCRIPTmaster:Make your windows read files writen in notepad! How to automatically shutdown your windows vista computer... Program your PC to turn off automatically by asigning which time you want it to do that 
Add instructable to: