; Only allows one copy of the script to run at a time, sets title $StartClock = "_StartClock_" If WinExists($StartClock) Then ProcessFound() AutoItWinSetTitle($StartClock) AutoItSetOption("WinTitleMatchMode", 4) Global $ExitScript, $Showdate, $PosA AutoItSetOption("TrayIconHide", 1) ; value of 0 to display a tray icon HotKeySet("^!x", "ExitScript");CTRL+ALT+X HotKeySet("^!d", "ShowDate");CTRL+ALT+D $PosA=controlgetpos("classname=Shell_TrayWnd", "", "Button1") ; Gets original size of the start button $PosB=controlgetpos("classname=Shell_TrayWnd", "", "") ; Gets original size of the tray AdLibEnable("ResizBtn", 0) For $i = 0 To 86400 If @HOUR <= 11 AND Not @HOUR = 00 Then $Hour = 24 + @HOUR - 24 $AMPM = " AM" ElseIf @HOUR > 12 Then $Hour = @HOUR - 12 $AMPM = " PM" ElseIf @HOUR = 12 Then $Hour = @HOUR $AMPM = " PM" ElseIf @HOUR = 00 Then $Hour = "12" $AMPM = " AM" EndIf $Mins = @MIN ; go forward one minute - since no seconds If $Mins<10 Then $Mins = $Mins $Time = $Hour & ":" & $Mins & $AMPM Sleep(60-@SEC) ; refresh time, 60 seconds - current seconds Next ;Functions List Func ShowDate () Run ("rundll32.exe shell32.dll,Control_RunDLL timedate.cpl") EndFunc Func ResizBtn() ControlMove("classname=Shell_TrayWnd", "", "Button1", $PosA[0], $PosA[1], $PosA[2]*1.4) If $PosB[2] > $PosB[3] Then ControlMove("classname=Shell_TrayWnd", "", "ReBarWindow321", $PosA[2]*1.45, 0) EndIf ControlSetText("classname=Shell_TrayWnd", "", "Button1", $Time) ; displays time EndFunc Func ProcessFound() MsgBox ( 0, "StartClock", "Only one copy of StartClock can be run at once." ) Exit EndFunc Func RestoreWin() If $PosB[2] > $PosB[3] Then ControlMove("classname=Shell_TrayWnd", "", "ReBarWindow321", $PosA[2]+$PosA[2]*0.06, 0) EndIf EndFunc Func ExitScript() RestoreWin() ControlSetText("classname=Shell_TrayWnd", "", "Button1", "start") ControlMove("classname=Shell_TrayWnd", "", "Button1", $PosA[0], $PosA[1], $PosA[2], $PosA[3]) AdLibDisable() Exit EndFunc Exit