I need a way to show the clock when on FullScreen (Not for games, but on Youtube Video Players etc)

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
fenchai
Posts: 292
Joined: 28 Mar 2016, 07:57

I need a way to show the clock when on FullScreen (Not for games, but on Youtube Video Players etc)

15 Jan 2018, 22:47

This is the code to detect full screen that works perfectly

Code: Select all

	isWindowFullScreen( winTitle ) {
		;checks if the specified window is full screen
		
		winID := WinExist( winTitle )

		If ( !winID )
			Return false

		WinGet style, Style, ahk_id %WinID%
		WinGetPos ,,,winW,winH, %winTitle%
		; 0x800000 is WS_BORDER.
		; 0x20000000 is WS_MINIMIZE.
		; no border and not minimized
		Return ((style & 0x20800000) or winH < A_ScreenHeight or winW < A_ScreenWidth) ? false : true
	}
How do I make this clock GUi show in the screen when it is on full screen?

Code: Select all

#Warn
#NoEnv
#SingleInstance Force

#NoTrayIcon
FormatTime, var0,, h:mm:ss tt

Gui, +AlwaysOnTop +ToolWindow -SysMenu -Caption
Gui, Color, cA0F1FD
Gui, Font, cFF0000 s10 w700, verdana
Gui, Add, Text, y0 vD, % A_MMMM " " A_DD NatSuf(A_DD) ", " A_YYYY " - " var0
Gui, Show, NoActivate x485 y530, uptime

		WinGetPos X, Y, Width, Height, uptime
		MaxX := A_ScreenWidth - Width  - 1637
		MaxY := A_ScreenHeight - Height - 75
		WinMove uptime, ,%MaxX%, %MaxY% ;set window to bottom right corner

WinSet, TransColor, CCCCCC 100,uptime ;set transparency
SetTimer, RefreshD, 1000
return

RefreshD:
    FormatTime, var0,, h:mm:ss tt
    GuiControl,, D, % A_MMMM " " A_DD NatSuf(A_DD) ", " A_YYYY " - " var0
return

NatSuf(n) ; by VxE
{
    return Mod(n + 9, 10) >= 3 || Mod(n + 89, 100) < 3 ? "th"
    : Mod(n, 10) = 1 ? "st" : Mod(n, 10) = 2 ? "nd" : "rd"
}


What I have tried...

- I used a settimer to detect if it is fullscreen every 200 ms, if it is, run this gui. else nothing. (Seems to work but I later wanted to move the gui and make it remember it's old position, tried to make it work but didn't work)

After doing all this, I figured someone may know an easier way to do this. My code looked like poop after all the failed atempts lol.
User avatar
king-of-hearts
Posts: 30
Joined: 01 Oct 2017, 06:29

Re: I need a way to show the clock when on FullScreen (Not for games, but on Youtube Video Players etc)

16 Jan 2018, 07:26

You can trys this one (unfortunally cant test it -working):

Code: Select all

#SingleInstance, Force
#NoEnv ;*[AHK]
#Persistent
DetectHiddenWindows, on
SetTitleMatchMode, 2
SendMode, Input

formattime, dait, M/d/yyyy h:mm:ss tt

Gui,+AlwaysOnTop
gui, add, text, vDayt, % dait
gui, show,, clock
SetTimer, Update, 500
return

Update:
formattime, dait, M/d/yyyy h:mm:ss tt
GuiControl,, Dayt, %Dait%
Return

ExitApp
esc:: ExitApp
https://autohotkey.com/boards/viewtopic.php?f=6&t=38707 - MS Access Manager - SQL Query: Incredible tool for MS Access/SQL Queries on the fly!!
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: I need a way to show the clock when on FullScreen (Not for games, but on Youtube Video Players etc)

16 Jan 2018, 09:09

Here's an idea. It sets the current window to not be on-top, which may or may not work. It uses the Progress command.

Code: Select all

q:: ;progress window in top-right corner
WinGet, hWnd, ID, A
WinGetClass, vWinClass, % "ahk_id " hWnd
if (vWinClass = "Shell_TrayWnd")
	return
WinSet, AlwaysOnTop, Off, % "ahk_id " hWnd
vFormat := "zh0 b1 c0 fs18" ;border + left
FormatTime, vDate,, HH:mm dd/MM/yyyy
vPosX := A_ScreenWidth - 400
Progress, % vFormat " x" vPosX " y0" vPosY, % vDate
return
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: downstairs, Google [Bot], OrangeCat and 181 guests