Display current time in a large format on screen Topic is solved
-
- Posts: 139
- Joined: 06 Nov 2022, 01:48
Display current time in a large format on screen
Sometimes I have to go a bit away from the computer for some time before returning back to the computer to continue my work. A large current time display on the screen would help as I need not check my phone(because the clock in the taskbar display is too small). Can someone assist me with this?
Re: Display current time in a large format on screen Topic is solved
Display a clock
Code: Select all
; This script displays a clock
#Requires AutoHotkey v1.1.33
Process Priority,, B
Gui Font, s150 w700
Gui Color, Black
Gui Add, Text, w900 cRed Center vtime
Gui Show,, Time
SetTimer Update, 1000
Update:
FormatTime, time,, HH:mm:ss
GuiControl,, time, % time
Return
GuiEscape:
GuiClose:
ExitApp
Re: Display current time in a large format on screen
This is exactly what I have been looking for. One question. Where would I go about putting a little set timer in to escape after say 5 seconds or whatever I choose. Tk's. Once again very nice.
Re: Display current time in a large format on screen
My take
Note: You can download Gdip_All, version 1.96 (2023-08-22) - by @robodesign (Marcus Șucan) from:
https://github.com/marius-sucan/AHK-GDIp-Library-Compilation/blob/master/ahk-v1-1/Gdip_All.ahk
Code: Select all
; Adapted from Gdip Tutorial 8 - Write.text.onto.a.gui
#SingleInstance, Force
#NoEnv
#Include <Gdip_all> ; Update it -> Path to your Gdip Library
If !pToken := Gdip_Startup() {
MsgBox, 48, gdiplus error!, Gdiplus failed to start. Please ensure you have gdiplus on your system
ExitApp
}
Width := 1400, Height := 1050
Font := "Arial"
Options := "x10p y30p w80p Centre cbbff0000 r4 s72 Bold" ; "s72" is Font size, change it for whatever size you want
return
q::
Gui, 1: -Caption +E0x80000 +LastFound +AlwaysOnTop +ToolWindow +OwnDialogs
Gui, 1: Show, NA
global hwnd1 := WinExist()
global hbm := CreateDIBSection(Width, Height)
global hdc := CreateCompatibleDC()
global obm := SelectObject(hdc, hbm)
global G := Gdip_GraphicsFromHDC(hdc)
Gdip_SetSmoothingMode(G, 4)
SetTimer, ShowTimeGdip, 1000
return
ShowTimeGdip:
FormatTime, T, % A_Now, HH:mm:ss
Gdip_GraphicsClear(G, 0x00000000)
Gdip_TextToGraphics(G, T, Options, Font, Width, Height)
UpdateLayeredWindow(hwnd1, hdc, (A_ScreenWidth-Width)//2, (A_ScreenHeight-Height)//2, Width, Height)
Return
Esc::
SelectObject(hdc, obm)
DeleteObject(hbm)
DeleteDC(hdc)
Gdip_DeleteGraphics(G)
Gdip_Shutdown(pToken)
ExitApp
return
https://github.com/marius-sucan/AHK-GDIp-Library-Compilation/blob/master/ahk-v1-1/Gdip_All.ahk
Re: Display current time in a large format on screen
A new timer could be added wherever you want it to start running. Give it a go.
Re: Display current time in a large format on screen
@mikey. I think you misunderstood. I don't want to start a new clock. Just put in a set timer or sleep and close after 5 seconds. Just need help on where to put that command in your script Mikey. Thank you.
Re: Display current time in a large format on screen
Hello,
This addition will be straightforward. You would insert the SetTimer command at the place in the script where you would like the command to execute and the timer to start. For example, if you would like the timer to start after the GUI is shown, you would insert the command after the Gui Show line.
Below are additional examples of using a timer.
https://www.autohotkey.com/docs/v1/lib/SetTimer.htm#ExampleClose
viewtopic.php?f=76&t=122772&p=545433&hilit=settimer#p545433
viewtopic.php?f=76&t=123850&p=555435&hilit=settimer#p555435
This addition will be straightforward. You would insert the SetTimer command at the place in the script where you would like the command to execute and the timer to start. For example, if you would like the timer to start after the GUI is shown, you would insert the command after the Gui Show line.
Below are additional examples of using a timer.
https://www.autohotkey.com/docs/v1/lib/SetTimer.htm#ExampleClose
viewtopic.php?f=76&t=122772&p=545433&hilit=settimer#p545433
viewtopic.php?f=76&t=123850&p=555435&hilit=settimer#p555435
Re: Display current time in a large format on screen
@mikey. Understood.Thank you.
-
- Posts: 139
- Joined: 06 Nov 2022, 01:48
Re: Display current time in a large format on screen
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
; This script displays a clock
#Requires AutoHotkey v1.1.33
toggle:=1
!t::
{
if (toggle=1)
{
toggle=0
Gui, destroy
Process Priority,, B
Gui +AlwaysonTop
Gui Font, s150 w700
Gui Color, Black
Gui Add, Text, w900 cWhite Center vtime
;Gui Show,x10 yCenter, Time
Gui, Show, % "x" A_ScreenWidth - 1600 " h" 500, Time
SetTimer Update, 1000
Update:
FormatTime, time,, HH:mm:ss
GuiControl,, time, % time
Return
}
else
{
Winminimize, Time ahk_class AutoHotkeyGUI ahk_exe AutoHotkey.exe
toggle:=1
}
}
GuiEscape:
GuiClose:
Gui, destroy
return