Opt( "TrayIconHide", 1 ); value of 0 to display a tray icon Opt( "WinTitleMatchMode", 4 ) Opt( "WinTextMatchMode", 2 ) ; Checks to see if StartClock is already running If WinExists( "_StartClock" ) Then MsgBox ( 0, "StartClock", "Only one copy of StartClock can be run at once." ) Exit EndIf AutoItWinSetTitle( "_StartClock" ) HotKeySet( "^!x", "ExitScript" ); CTRL+ALT+X HotKeySet( "^!d", "ShowDate" ); CTRL+ALT+D $OldBtnPos = controlgetpos( "classname=Shell_TrayWnd", "", "Button1" ) ; Gets original size of the start button $OldTrayPos = controlgetpos( "classname=Shell_TrayWnd", "", "" ) ; Gets original size of the tray $AdLibRefresh = 0 ; Avoids delay for the clock to appear when first started 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 $Time = $Hour & ":" & $Mins & $AMPM ControlSetText("classname=Shell_TrayWnd", "", "Button1", $Time) ; displays time AdLibEnable( "ResizBtn", $AdLibRefresh ) Sleep ( 60000 - (1000 * @SEC) ) ; Pauses script based on time until next minuite Next ;Functions List Func ResizBtn() $AdLibRefresh = 10000 ; Milliseconds delay between checks RestoreWin() ControlMove("classname=Shell_TrayWnd", "", "Button1", $OldBtnPos[0], $OldBtnPos[1], $OldBtnPos[2]*1.4) If $NewTrayPos[2] > $NewTrayPos[3] Then ControlMove("classname=Shell_TrayWnd", "", "ReBarWindow321", $OldBtnPos[2]*1.45, 0) EndIf ControlSetText("classname=Shell_TrayWnd", "", "Button1", $Time) ; displays time EndFunc Func RestoreWin() $NewTrayPos = controlgetpos("classname=Shell_TrayWnd", "", "") ; Gets size of the tray If $NewTrayPos[2] > $NewTrayPos[3] Then ; Compare horizontal size of the tray to vertical ControlMove("classname=Shell_TrayWnd", "", "ReBarWindow321", $OldBtnPos[2]+$OldBtnPos[2]*0.06, 0) EndIf EndFunc Func ShowDate() ; Displays date menu Run ("rundll32.exe shell32.dll,Control_RunDLL timedate.cpl") EndFunc Func ExitScript() RestoreWin() ControlSetText("classname=Shell_TrayWnd", "", "Button1", "start") ControlMove("classname=Shell_TrayWnd", "", "Button1", $OldBtnPos[0], $OldBtnPos[1], $OldBtnPos[2], $OldBtnPos[3]) AdLibDisable() Exit EndFunc Exit