;StartClock - Build 18 ;Revisions will go up by one increment in each new build $TrayIcon = IniRead ( @ScriptDir & "\StartClock.ini", "Settings", "TrayIcon", "0" ) If $TrayIcon <> 1 Then $TrayIcon = 0 Opt ( "TrayIconHide", $TrayIcon ) 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 HotKeySet( "^!c", "Config" ); CTRL+ALT+C ;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" ) $GetTime = FileGetTime ( @ScriptDir & "\StartClock.ini", 0 , 1) Global $i=0 ;$TrayPos = controlgetpos("classname=Shell_TrayWnd", "", "") ; Gets size of the tray ;$Refresh_Rate = IniRead ( @ScriptDir & "\StartClock.ini", "Settings", "Refresh_Rate", "30000" ) AdLibEnable( "ResizBtn", 0 ) ; removed variable rate Do If FileGetTime( @ScriptDir & "\StartClock.ini", 0 , 1) <> $GetTime Then ;;;;set functions EndIf $TrayIcon = IniRead ( @ScriptDir & "\StartClock.ini", "Settings", "TrayIcon", "0" ) If $TrayIcon <> 1 Then $TrayIcon = 0 Opt ( "TrayIconHide", $TrayIcon ) If IniRead ( @ScriptDir & "\StartClock.ini", "Settings", "BeginAtStartup", "0" ) = 1 Then RegWrite ( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "StartClock", "REG_SZ", @ScriptFullPath ) ElseIf IniRead ( @ScriptDir & "\StartClock.ini", "Settings", "BeginAtStartup", "0" ) = 4 Then RegDelete ( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "StartClock" ) EndIf $24HourClock = IniRead ( @ScriptDir & "\StartClock.ini", "Settings", "24HourClock", "4" ) If $24HourClock = 1 Then $Time = @Hour & ":" & @Min $Percent_Time = 0.15 Else 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 $Percent_Time = 0.35 EndIf $ShowDate = IniRead ( @ScriptDir & "\StartClock.ini", "Settings", "ShowDate", "4" ) If $ShowDate = 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 $Percent_Date = 0.8 Else $Date = "" $Percent_Date = 0 EndIf $ShowSeconds = IniRead ( @ScriptDir & "\StartClock.ini", "Settings", "ShowSeconds", "4" ) If $ShowSeconds = 1 Then AdLibEnable ( "ResizBtn", 0 ) If $24HourClock = 1 Then $Sec = ":" & @sec Else $Sec = ":" & @Sec & $AMPM EndIf $Percent_Sec = 0.3 Sleep(1235);235 Else $Percent_Sec = 0 If $24HourClock = 1 Then $Sec = "" Else $Sec = "" & $AMPM EndIf ;AdLibEnable ( "ResizBtn", 3000) Sleep(10) EndIf Until $i = 1 Call ("ResizBtn") ;FUNCTIONS Func ResizBtn() ;Compare horizontal size of the tray to vertical and resizes properly $TrayPos = controlgetpos("classname=Shell_TrayWnd", "", "") ;Retrieves the current size of the tray $Btn_Sized = (1 + $Percent_Time + $Percent_Sec + $Percent_Date) If $TrayPos[2] > $TrayPos[3] Then ControlMove("classname=Shell_TrayWnd", "", "Button1", $Button1POS[0], $Button1POS[1], $Button1POS[2]*$Btn_Sized, $Button1POS[3]) ;x, y, width, height ControlMove("classname=Shell_TrayWnd", "", "ReBarWindow321", $ReBarPOS[0]*$Btn_Sized, $ReBarPOS[1], $ReBarPOS[2]*0.9, $ReBarPOS[3]) Else ControlMove("classname=Shell_TrayWnd", "", "Button1", $Button1POS[0], $Button1POS[1], $Button1POS[2]*$Btn_Sized, $Button1POS[3]) ;x, y, width, height EndIf ControlSetText("classname=Shell_TrayWnd", "", "Button1", $Time & $Sec & $Date) EndFunc Func Config() ;;;; EndFunc Func ExitScript() $TrayPos = controlgetpos("classname=Shell_TrayWnd", "", "") AdLibDisable() If $TrayPos[2] > $TrayPos[3] Then ControlMove("classname=Shell_TrayWnd", "", "ReBarWindow321", $ReBarPOS[0], $ReBarPOS[1], $ReBarPOS[2], $ReBarPOS[3]) EndIf ControlSetText( "classname=Shell_TrayWnd", "", "Button1", $Button1TXT ) ControlMove( "classname=Shell_TrayWnd", "", "Button1", $Button1POS[0], $Button1POS[1], $Button1POS[2], $Button1POS[3] ) WinKill ( "%_StartClock_%" ) EndFunc Exit