Step 2Detailed description of the code in the script...
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...
| « Previous Step | Download PDFView All Steps | Next Step » |








































http://versus.comlu.com/articles.html