;StartClock - Build 18 ;Revisions will go up by one increment in each new build ;Checks to see if StartClock is already running If WinExists ( "%_StartClock_%" ) Then WinKill ( "%_StartClock_%" ) EndIf AutoItWinSetTitle ( "%_StartClock_%" ) If NOT FileExists ( @ScriptDir & "\StartClock.ini" ) Then Config() $TrayIcon = IniRead ( @ScriptDir & "\StartClock.ini", "Settings", "TrayIcon", "0" ) If $TrayIcon <> 1 Then $TrayIcon = 0 Opt ( "TrayIconHide", $TrayIcon ) Opt ( "WinTitleMatchMode", 4 ) Opt ( "WinTextMatchMode", 2 ) ;VARIABLES $Button1TXT = ControlGetText ( "classname=Shell_TrayWnd", "", "Button1" ) ;Start Button $Button1POS = ControlGetPos( "classname=Shell_TrayWnd", "", "Button1" ) ;Start Button NEW replace $Button1POS eventually $ReBarPOS = ControlGetPos ( "classname=Shell_TrayWnd", "", "ReBarWindow321" ) ;entire runningApp and quicklaunch area $GetTime = FileGetTime ( @ScriptDir & "\StartClock.ini", 0 , 1) $ClockType = IniRead ( @ScriptDir & "\StartClock.ini", "Settings", "ClockType", "1" ) $ShowDate = IniRead ( @ScriptDir & "\StartClock.ini", "Settings", "ShowDate", "4" ) $ShowSeconds = IniRead ( @ScriptDir & "\StartClock.ini", "Settings", "ShowSeconds", "4" ) $AMPM = "" If IniRead ( @ScriptDir & "\StartClock.ini", "Settings", "EnableHotkeys", "4" ) = 4 Then HotKeySet( "^!x", "ExitScript" ); CTRL+ALT+X HotKeySet( "^!c", "Config" ); CTRL+ALT+C EndIf AdLibEnable( "ResizBtn", 250 ) Do ;DYNAMIC OPTIONS If FileGetTime( @ScriptDir & "\StartClock.ini", 0 , 1) <> $GetTime Then $ClockType = IniRead ( @ScriptDir & "\StartClock.ini", "Settings", "ClockType", "1" ) $ShowDate = IniRead ( @ScriptDir & "\StartClock.ini", "Settings", "ShowDate", "4" ) $ShowSeconds = IniRead ( @ScriptDir & "\StartClock.ini", "Settings", "ShowSeconds", "4" ) $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 ) Else RegDelete ( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "StartClock" ) EndIf If IniRead ( @ScriptDir & "\StartClock.ini", "Settings", "EnableHotkeys", "4" ) = 4 Then HotKeySet( "^!x", "ExitScript" ); CTRL+ALT+X HotKeySet( "^!c", "Config" ); CTRL+ALT+C EndIf EndIf ;SET TIME PROPERTIES If $ClockType = 4 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 ;SET DATE PROPERTIES 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 ;SET SECONDS PROPERTIES If $ShowSeconds = 1 Then If $ClockType = 1 Then $Sec = ":" & @sec Else $Sec = ":" & @Sec & $AMPM EndIf $Percent_Sec = 0.3 Else $Percent_Sec = 0 If $ClockType = 1 Then $Sec = "" Else $Sec = "" & $AMPM EndIf EndIf $Btn_Sized = (1 + $Percent_Time + $Percent_Sec + $Percent_Date) Sleep(1000) $Button1Class = ControlMove("classname=Shell_TrayWnd", "", "Button1", $Button1POS[0], $Button1POS[1], $Button1POS[2]*$Btn_Sized, $Button1POS[3]);TEST VARIABLE Until 1 <> 1 ;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 If $TrayPOS[2] > $TrayPOS[3] Then ControlMove("classname=Shell_TrayWnd", "", "ReBarWindow321", $ReBarPOS[0]*$Btn_Sized, $ReBarPOS[1], $ReBarPOS[2]*0.9, $ReBarPOS[3]) EndIf ControlMove("classname=Shell_TrayWnd", "", "Button1", $Button1POS[0], $Button1POS[1], $Button1POS[2]*$Btn_Sized, $Button1POS[3]) ;x, y, width, height ControlSetText("classname=Shell_TrayWnd", "", "Button1", $Time & $Sec & $Date) EndFunc Func Config() Run ( "options_GUI.exe", @ScriptDir ) EndFunc Func ExitScript() AdLibDisable() $TrayPOS = controlgetpos("classname=Shell_TrayWnd", "", "ReBarWindow321") 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