This script runs on my PC 24/7 (Windows 7) and looks for the creation of a folder with a keyname. This folder is within another folder which is accessible via my FTP server. (I recommend the free and excellent FileZilla program)
So by using any free FTP App on my Tablet/phone I can hibernate, reboot or shutdown my PC.
Keyname words are :
Suspend
Shutdown
Reboot
Hibernate
(lettercase isn't important)
The script reads the specified folder every 10 secs and on seeing one of these keywords in a new folder it will perform the action within 30secs.
Alternatively, if you add "_XXX" to the folder name where XXX is the number of seconds (up to 999) it will perform the action with that delay.
Alternatively, if you use "_XXYY" where XXYY is the 24 hour clock format (ie 2305) it will perform that action at that time of day.
This script needs the free psshutdown.exe utility V2.52 by Microsoft/Sysinternals
<!-- m -->http://technet.micro... ... s/bb897541<!-- m -->
Just place the psshutdown.exe in a folder indicated by your PCs PATH variable.
#Persistent #SingleInstance force settimer, shutdown, 10000 SetTimer,UPDATEDSCRIPT,1000 ; Alter this path to suit yourself. ; Remember it must be accessible via your FTP server path:="Z:\Shutdown_reboot\" return shutdown: ;======================================================================== ifexist,%path%suspend* { flag=TRUE ps="-d" loop,%path%suspend*,1 { originalname:=A_LoopFileName break } stringgetpos,offset,originalname,_ if errorlevel { time:=25 timemess:= "suspending in " . time . " seconds." } else { stringmid,name,originalname,offset + 2,4 stringlen,len,name if len =4 { stringleft,hour,name,2 stringright,mins,name,2 time:=hour . ":" . mins timemess:= "be suspending at " . time . " hours." } else { time:= name timemess:= "be suspending in " . time . " seconds." } } } ;======================================================================== ifexist,%path%shutdown* { flag=TRUE ps="-k" loop,%path%shutdown*,1 { originalname:=A_LoopFileName break } stringgetpos,offset,originalname,_ if errorlevel { time:=25 timemess:= "shut down in " . time . " seconds." } else { stringmid,name,originalname,offset + 2,4 stringlen,len,name if len =4 { stringleft,hour,name,2 stringright,mins,name,2 time:=hour . ":" . mins timemess:= "shut down at " . time . " hours." } else { time:= name timemess:= "be shutting down in " . time . " seconds." } } } ;======================================================================== ifexist,%path%reboot* { flag=TRUE ps="-r" loop,%path%reboot*,1 { originalname:=A_LoopFileName break } stringgetpos,offset,originalname,_ if errorlevel { time:=25 timemess:= "reboot in " . time . " seconds." } else { stringmid,name,originalname,offset + 2,4 stringlen,len,name if len =4 { stringleft,hour,name,2 stringright,mins,name,2 time:=hour . ":" . mins timemess:= "reboot at " . time . " hours." } else { time:= name timemess:= "be rebooting in " . time . " seconds." } } } ;======================================================================== ifexist,%path%hibernate* { flag=TRUE ps="-h" loop,%path%hibernate*,1 { originalname:=A_LoopFileName break } stringgetpos,offset,originalname,_ if errorlevel { time:=25 timemess:= "hibernate in " . time . " seconds." } else { stringmid,name,originalname,offset + 2,4 stringlen,len,name if len =4 { stringleft,hour,name,2 stringright,mins,name,2 time:=hour . ":" . mins timemess:= "hibernate at " . time . " hours." } else { time:= name timemess:= "be hibernating in " . time . " seconds." } } } if flag = TRUE { FileRemoveDir,%path%%originalname% msgbox,,,This Computer will %timemess%,5 Run, %comspec% /c "psshutdown %ps% -c -f -m "Remote Request to %timemess%" -t %time% -e p:01:01" flag=FALSE } return ;------------------------------------------------------------------------ UPDATEDSCRIPT: FileGetAttrib,attribs,%A_ScriptFullPath% IfInString,attribs,A { FileSetAttrib,-A,%A_ScriptFullPath% SplashTextOn,,,Updating script..., Sleep,500 Reload } Return ;ENDOFSCRIPT ;------------------------------------------------------------------------
Now I just need someone to make a Android App that can send a magic packet to my PC to wake it up!