fr Workaround on W2k/XP systems crashing after some days. Script placed in Autostart provides a daily automatic restart at given time. Requires ffidl and AutoIt. Needs Autologon configured in registry.
proc stop_jobs {} {
# final actions before shutdown
}
proc shut_message {delayseconds} {
toplevel .shut -background red
bind .shut <Any-Key> {exit}
label .shut.l -background yellow -font {Verdana 30} \
-text "System restarts in $delayseconds seconds!\nPress any key to cancel"
pack .shut.l -padx 30 -pady 30
focus -force .shut
after [expr $delayseconds*1000] {set ::waited 1}
}
if {[regexp -nocase windows $::env(OS)]} {
package require Tk
load ffidl05.dll
set DLL AutoItDLL.dll
ffidl::callout AUTOIT_Shutdown {int} int [ffidl::symbol $DLL AUTOIT_Shutdown]
set now [clock seconds]
set shutdown_time 17:19:00
. configure -bg green
wm overrideredirect . 1
label .l -text "The system will restart at $shutdown_time !" -font {Courier 16}
pack .l -padx 20 -pady 20
after 2000 {set ::infovar 1}
vwait ::infovar
wm withdraw .
set fin [clock scan $shutdown_time]
if {$fin<$now} {
incr fin [expr 3600*24]
}
set delay [expr $fin - $now]
set delay [expr $delay * 1000]
after $delay {
shut_message 60
vwait ::waited
stop_jobs
AUTOIT_Shutdown 3
}
vwait forever
}MHo: Much more simple is this: at hh:mm /every: datespec[,...] "shutdown -r". Both tools are in my Windows/System32-Folder on my home system (Windows/XP). They should be installed on almost every modern Win-System. But nevertheless, your solution is very interesting... (Sometimes windows is not as dump as it seems....)