;StartClock - Build 13 ;Revisions will go up by one increment in each new build $DisableTrayIcon = IniRead ( @ScriptDir & "\StartClock.ini", "Settings", "DisableTrayIcon", "1" ) Opt ( "TrayIconHide", $DisableTrayIcon ) Opt ( "WinTitleMatchMode", 4 ) Opt ( "WinTextMatchMode", 2 ) ;Checks to see if StartClock is already running If WinExists ( "%_StartClock_%" ) Then WinKill ( "%_StartClock_%" ) EndIf AutoItWinSetTitle ( "%_StartClock_%" ) ;hotkeys HotKeySet( "^!x", "ExitScript" ); CTRL+ALT+X ;remembers original location of menus to be modified $Button1TXT = ControlGetText ( "classname=Shell_TrayWnd", "start", "Button1" ) ;Start Button $Button1POS = ControlGetPos( "classname=Shell_TrayWnd", "start", "Button1" ) ;Start Button NEW replace $Button1POS eventually $ReBarPOS = ControlGetPos ( "classname=Shell_TrayWnd", "", "ReBarWindow321" ) ;entire runningApp and quicklaunch area $TrayNotifyPOS = ControlGetPos ( "classname=Shell_TrayWnd", "", "TrayNotifyWnd1" ) ;entire Tray Notify Window ;$QuickLaunchPOS = ControlGetPos( "classname=Shell_TrayWnd", "Quick Launch", "ToolbarWindow323" ) ;$RunningAppsPOS = ControlGetPos ( "classname=Shell_TrayWnd", "Running Applications", "ToolbarWindow322" ) ;$NotificationAreaPOS = ControlGetPos ( "classname=Shell_TrayWnd", "", "ToolbarWindow321" ) Global $i=0 $TrayPos = controlgetpos("classname=Shell_TrayWnd", "", "") ; Gets size of the tray ;ini functions If IniRead ( @ScriptDir & "\StartClock.ini", "Settings", "RunAtStartUp", "0" ) = 1 Then RegWrite ( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "StartClock", "REG_SZ", @ScriptFullPath ) ElseIf IniRead ( @ScriptDir & "\StartClock.ini", "Settings", "RunAtStartUp", "0" ) = 0 Then RegDelete ( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "StartClock" ) EndIf $Refresh_Rate = IniRead ( @ScriptDir & "\StartClock.ini", "Settings", "Refresh_Rate", "30000" ) AdLibEnable( "ResizBtn", $Refresh_Rate ) $EnableDate = IniRead ( @ScriptDir & "\StartClock.ini", "Settings", "EnableDate", "0" ) If $EnableDate = 1 Then If @mon = 1 then $mon = "Jan" ElseIf @mon = 2 then $mon = "Feb" ElseIf @mon = 3 then $mon = "Mar" ElseIf @mon = 4 then $mon = "Apr" ElseIf @mon = 5 then $mon = "May" ElseIf @mon = 6 then $mon = "June" ElseIf @mon = 7 then $mon = "July" ElseIf @mon = 8 then $mon = "Aug" ElseIf @mon = 9 then $mon = "Sept" ElseIf @mon = 10 then $mon = "Oct" ElseIf @mon = 11 then $mon = "Nov" ElseIf @mon = 12 then $mon = "Dec" EndIf $Date = " - " & $MON & " " & @MDAY Else $Date = "" EndIf $24HourClock = IniRead ( @ScriptDir & "\StartClock.ini", "Settings", "24HourClock", "0" ) If $24HourClock = 1 Then Do $Time = @Hour & ":" & @Min Until $i = 1 Else Do 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 $EnableSeconds = IniRead ( @ScriptDir & "\StartClock.ini", "Settings", "EnableSeconds", "0" ) If $EnableSeconds = 1 Then $Time = $Hour & ":" & @Min & ":" & @Sec & $AMPM AdLibEnable ( "ResizBtn", 0 ) Else $Time = $Hour & ":" & @Min & $AMPM EndIf Until $i = 1 EndIf Call ("ResizBtn") ;fucntions Func ResizBtn() ControlHide ( "classname=Shell_TrayWnd", "", "TrayClockWClass1" ) If $24HourClock = 1 Then If $EnableDate = 1 Then ControlMove("classname=Shell_TrayWnd", "", "Button1", $Button1POS[0], $Button1POS[1], $Button1POS[2]*2) Else ControlMove("classname=Shell_TrayWnd", "", "Button1", $Button1POS[0], $Button1POS[1], $Button1POS[2]*1.15) EndIf Else If $EnableSeconds = 1 Then Else EndIf EndIf ; 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 If $24HourClock = 1 Then If $EnableDate = 1 Then ControlMove("classname=Shell_TrayWnd", "", "ReBarWindow321", $Button1POS[2]*2, 0) Else ControlMove("classname=Shell_TrayWnd", "", "Button1", $Button1POS[0], $Button1POS[1], $Button1POS[2]*1.15) EndIf Else If $EnableSeconds = 1 Then ControlMove("classname=Shell_TrayWnd", "", "ReBarWindow321", $Button1POS[[2]*1.75, 0) Else ControlMove("classname=Shell_TrayWnd", "", "ReBarWindow321", $Button1POS[2]*1.45, 0) EndIf EndIf EndIf ControlSetText("classname=Shell_TrayWnd", "", "Button1", $Time & $Date) EndFunc Func ExitScript() AdLibDisable() ControlShow ( "classname=Shell_TrayWnd", "", "TrayClockWClass1" ) If $TrayPos[2] > $TrayPos[3] Then ControlMove( "classname=Shell_TrayWnd", "", "ReBarWindow321", $Button1POS[2]+$Button1POS[2]*0.06, 0 ) EndIf ControlSetText( "classname=Shell_TrayWnd", "", "Button1", $Button1TXT ) ControlMove( "classname=Shell_TrayWnd", "", "Button1", $Button1POS[0], $Button1POS[1], $Button1POS[2], $Button1POS[3] ) WinKill ( "%_StartClock_%" ) EndFunc Exit