ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Finished Programs

FastShutdown

(1/2) > >>

Nod5:
;-- Fast Shutdown -- by Nod5
;-- v090426
;-- does a onestep windows shutdown unless there are scheduled tasks later the same day
;-- default hotkeys: (middle click on Start button) OR (Right Shift + Escape)

A quick script for Win XP that I needed myself. ahk & exe in attached zip. I'll package it nicer later.

b48b1bb31a479ac4a3467f5f9297c77f *FastShutdown.ahk
e388781005816e81f7e4d92086a9d2e6 *FastShutdown.exe


--- ---;-- Fast Shutdown -- by Nod5
;-- v090426
;-- does a onestep windows shutdown unless there are scheduled tasks later the same day
;-- default hotkeys: (middle click on Start button) OR (Right Shift + Escape)

#singleinstance, force
~Mbutton::

MouseGetPos,,,xxid, xxcontr
WinGetClass, xxstart, ahk_id %xxid%
if xxstart = Shell_TrayWnd ;-- if mouse over start button
 if xxcontr = Button1
   goto fastshutdown
return

RShift & Esc::
fastshutdown:
xout =
xvar =
x = %A_Temp%\%A_now%.txt
RunWait %comspec% /c "schtasks > "%x%"",,Hide
FileRead, xvar, %x%
FileDelete, %x%
Loop, Parse, xvar, `n, `r
{
if A_LoopField contains %A_YYYY%-%A_MM%-%A_DD%
 xout = %xout%`n%A_Loopfield%
}
if xout !=
{
MsgBox, 1, Fast Shutdown, %xout%`n`nReally shutdown?
IfMsgBox, OK
 Shutdown, 1
}
else
{
MsgBox, 1, Fast Shutdown, Shutdown in 5 seconds...,5
IfMsgBox, OK
 Shutdown, 1
IfMsgbox, Timeout
 Shutdown, 1
}
return

Nod5:
FastShutdown uses the "schtasks" command to output a list of scheduled tasks and then searches for the current date in it. Can someone with english XP installed please check if you have the save date format as my non-english install i.e. YYYY-MM-DD. Just do this: run > cmd > schtasks    and the list will show itself.  :Thmbsup:

rgdot:
English (Canada)

TaskName                             Next Run Time
==================================== =====================
Ad-Aware Update (Weekly)             18:23:00, 27/04/2009

pencoe:
German XP SP2(! SP3 will not install on this machine, time to change...  ;) ):

Taskname                             Nächste Ausführungszeit
==================================== ========================
SampleTask              09:15:00, 06.05.2009

Nod5:
Ok, so I need to query the local date format from within the AHK script. I'll try to sort it out tonight.

Navigation

[0] Message Index

[#] Next page

Go to full version