How use a hotkey to turn off the timer Topic is solved

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
songdg
Posts: 626
Joined: 04 Oct 2017, 20:04

How use a hotkey to turn off the timer

23 Apr 2024, 04:59

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.
Draken
Posts: 96
Joined: 08 Dec 2022, 01:19

Re: How use a hotkey to turn off the timer  Topic is solved

23 Apr 2024, 05:21

stop timer

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)
}
songdg
Posts: 626
Joined: 04 Oct 2017, 20:04

Re: How use a hotkey to turn off the timer

23 Apr 2024, 07:03

Thanks, much appreciated :clap:

Return to “Ask for Help (v2)”

Who is online

Users browsing this forum: arout, Descolada, Google [Bot], Lpanatt and 74 guests