Page 1 of 1
Toggle Magnifier
Posted: 06 Jan 2022, 00:28
by SundayProgrammer
don't like to have two hotkeys for opening/closing magnifier, hence attempted to write a toggle. and turned out it needs a trick to work. so this may save you some time from struggling if you also want such a toggle one day.
Code: Select all
Capslock::Gosub, ToggleMagnifier
ToggleMagnifier:
IfWinActive, ahk_exe Magnify.exe
Gui, Show,, Magnifier Dummy Prompt
IfWinExist, ahk_exe Magnify.exe
{ Send, #{Esc}
IfWinExist, Magnifier Dummy Prompt
WinClose
}Else Run, Magnify
Return
Re: Toggle Magnifier
Posted: 19 Jan 2022, 10:58
by TheDewd
The following works for me on Windows 10:
Code: Select all
#SingleInstance, Force
Capslock::
Process, Exist, Magnify.exe
If (ErrorLevel) {
Send, #{Esc}
} Else {
Run, Magnify.exe
}
return
Re: Toggle Magnifier
Posted: 19 Jan 2022, 11:31
by SundayProgrammer
TheDewd wrote: ↑19 Jan 2022, 10:58
The following works for me on Windows 10:
Code: Select all
#SingleInstance, Force
Capslock::
Process, Exist, Magnify.exe
If (ErrorLevel) {
Send, #{Esc}
} Else {
Run, Magnify.exe
}
return
try this scenario: 1, set the magnifier to lens view; 2, switch on the magnifier; 3, touch (touchscreen assumed) somewhere outside the lens; 4, use your finger to move the lens by its handle (now, the lens itself becomes an active window); 5, try your toggle now, it's no longer working.
Re: Toggle Magnifier
Posted: 19 Jan 2022, 20:39
by SKAN
@SundayProgrammer
Thanks. I didn't know about #Esc key.
I will be using it like follows:
( i.e, equivalent code in V2)
Code: Select all
#NoEnv
#Warn
#SingleInstance, Force
#IfWinExist ahk_class MagUIClass
#NumPadMult:: Send, #{Esc}
#IfWinExist
Re: Toggle Magnifier
Posted: 19 Jan 2022, 23:09
by SundayProgrammer
SKAN wrote: ↑19 Jan 2022, 20:39
@SundayProgrammer
Thanks. I didn't know about #Esc key.
thanks, @SKAN. i'm glad to learn that my post did help others, in whichever way it doesn't matter. and even just a bit. i gained a lot from this forum/community.
Re: Toggle Magnifier
Posted: 19 Jan 2022, 23:44
by SKAN
SundayProgrammer wrote: ↑19 Jan 2022, 23:09
in whichever way it doesn't matter. and even just a bit.
Just a bit?. This is huge for me.
I was just using default OS hotkeys:
#NumpadAdd starts magnifier and also zooms...
#NumpadSub unzooms...
But I never knew how to close it. WinClose() wouldn't do it.
All the Time I was clicking the close button to close magnifier.
Finally, a solution.
However there is a unfortunate limitation in Windows 7.
#NumpadAdd starts magnifier and also zooms...
But I have to release the win key before I can use win+NumpadMult.
In Win 10 & 11, I can just place the mouse cursor at point of interest and Open, zoom/unzoom, close without releasing the Windows key.