https://www.autohotkey.com/docs/v2/lib/Gui.htm#ExOSD
This is the On-screen display (OSD) example, I want to use a hotkey to turn off the timer, so that the text still on the screen but no longer change when moving the mouse.
How use a hotkey to turn off the timer Topic is solved
Re: How use a hotkey to turn off the timer Topic is solved
stop timer
ctrl + x shortcut to turn timer off and on again
Code: Select all
SetTimer(UpdateOSD, 0)
ctrl + x shortcut to turn timer off and on again
Code: Select all
#Requires AutoHotkey 2.0
MyGui := Gui()
MyGui.Opt("+AlwaysOnTop -Caption +ToolWindow") ; +ToolWindow avoids a taskbar button and an alt-tab menu item.
MyGui.BackColor := "EEAA99" ; Can be any RGB color (it will be made transparent below).
MyGui.SetFont("s32") ; Set a large font size (32-point).
CoordText := MyGui.Add("Text", "cLime", "XXXXX YYYYY") ; XX & YY serve to auto-size the window.
; Make all pixels of this color transparent and make the text itself translucent (150):
WinSetTransColor(MyGui.BackColor " 150", MyGui)
SetTimer(UpdateOSD, 200)
UpdateOSD() ; Make the first update immediate rather than waiting for the timer.
MyGui.Show("x0 y400 NoActivate") ; NoActivate avoids deactivating the currently active window.
UpdateOSD(*)
{
MouseGetPos &MouseX, &MouseY
CoordText.Value := "X" MouseX ", Y" MouseY
}
^x::{
static toggle := 0
toggle := !toggle
If toggle
SetTimer(UpdateOSD, 0)
else
SetTimer(UpdateOSD, 200)
}
Re: How use a hotkey to turn off the timer
Thanks, much appreciated