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

DonationCoder.com Software > Finished Programs

FastShutdown

<< < (2/2)

Nod5:
Found a relevant registry entry:
[HKEY_USERS\.DEFAULT\Control Panel\International]
"sShortDate"="yyyy-MM-dd"
--- End quote ---

So for a complete solution I need to add:
1. code to read that on the local computer:

--- ---RegRead, dateformat, HKEY_USERS, .DEFAULT\Control Panel\International, sShortDate2. modify the script based on the format there. There might be a lot of different such formats so it is hard to cover them all.

Here's a non-complete quick fix that at least might satisfy Canadians, Swedes and Germans (as a rule, world domination is best achieved incrementally ;D )
But sometimes, just sometimes, it can be had straight away, muaHAHAHAHA  :P :


--- ---;-- Fast Shutdown -- by Nod5
;-- v090510b
;-- 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%
FormatTime, today, A_Now, ShortDate
Loop, Parse, xvar, `n, `r
{
if A_LoopField contains %today%
 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

(FormatTime in Autohotkey had a ShortDate option)

Navigation

[0] Message Index

[*] Previous page

Go to full version