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 ;Variables List $OldBtnPos = controlgetpos( "classname=Shell_TrayWnd", "", "Button1" ) ; Gets original size of the start button $TrayPos = controlgetpos( "classname=Shell_TrayWnd", "", "" ) ; Gets original size of the tray $Button1txt = ControlGetText ( "classname=Shell_TrayWnd", "", "Button1" ) 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 $Time = $Hour & ":" & @Min & $AMPM ControlSetText("classname=Shell_TrayWnd", "", "Button1", $Time) ; displays time Sleep ( 60000 - (1000 * @SEC) ) ; Pauses script based on time until next minute AdLibEnable( "ResizBtn", 10000 ) Next ;Functions List Func ResizBtn() ControlMove("classname=Shell_TrayWnd", "", "Button1", $OldBtnPos[0], $OldBtnPos[1], $OldBtnPos[2]*1.4) ; Compare horizontal size of the tray to vertical and resizes properly $TrayPos = controlgetpos("classname=Shell_TrayWnd", "", "") ; Gets size of the tray If $TrayPos[2] > $TrayPos[3] Then ControlMove("classname=Shell_TrayWnd", "", "ReBarWindow321", $OldBtnPos[2]*1.45, 0) EndIf ControlSetText("classname=Shell_TrayWnd", "", "Button1", $Time) ; displays time EndFunc Func ShowDate() ; Displays date menu Run ("rundll32.exe shell32.dll,Control_RunDLL timedate.cpl") EndFunc Func ExitScript() AdLibDisable() If $TrayPos[2] > $TrayPos[3] Then ControlMove( "classname=Shell_TrayWnd", "", "ReBarWindow321", $OldBtnPos[2]+$OldBtnPos[2]*0.06, 0 ) EndIf ControlSetText( "classname=Shell_TrayWnd", "", "Button1", $Button1txt ) ControlMove( "classname=Shell_TrayWnd", "", "Button1", $OldBtnPos[0], $OldBtnPos[1], $OldBtnPos[2], $OldBtnPos[3] ) Exit EndFunc Exit