How to use AutoHotkey to fix outlook keyboard shortcuts?
-
- Posts: 314
- Joined: 13 Dec 2015, 20:48
How to use AutoHotkey to fix outlook keyboard shortcuts?
There are 2 variations of the Outlook Reminder - one that comes with "Join Online" and one that doesn't. Rightfully, pressing "D" should dismiss either notification, but it only works in the first and not the second. Any idea what I can do to fix this annoyance?
Re: How to use AutoHotkey to fix outlook keyboard shortcuts?
Create a hotkey for the D key that is active only when an Outlook reminder popup is the active window:
Code: Select all
SetTitleMatchMode, 2
#IfWinActive, Reminder(s) ahk_class #32770 ahk_exe OUTLOOK.EXE
d::WinClose, Reminder(s) ahk_class #32770 ahk_exe OUTLOOK.EXE
- milkygirl90
- Posts: 565
- Joined: 10 Nov 2020, 21:22
Re: How to use AutoHotkey to fix outlook keyboard shortcuts?
interested to know too. d closes the window but doesn't dismiss the event and a doesn't work for Dismiss All and J doesn't work for Join Teams meeting (depending on which screen is activated). any idea how to resolve it?
- milkygirl90
- Posts: 565
- Joined: 10 Nov 2020, 21:22
Re: How to use AutoHotkey to fix outlook keyboard shortcuts?
I didn’t answer this question yet because I use Outlook but not Teams, so I was seeing if someone who does might reply.
Instead of using WinClose, you should be able to have it click the desired button, which should dismiss or join as applicable. I haven’t tried ControlClick, but that would be best — if it works on these windows. Apparently sending keyboard shortcuts wouldn’t work. Worst case, you could Click the buttons by known location or by found image location.
Instead of using WinClose, you should be able to have it click the desired button, which should dismiss or join as applicable. I haven’t tried ControlClick, but that would be best — if it works on these windows. Apparently sending keyboard shortcuts wouldn’t work. Worst case, you could Click the buttons by known location or by found image location.
- milkygirl90
- Posts: 565
- Joined: 10 Nov 2020, 21:22
Re: How to use AutoHotkey to fix outlook keyboard shortcuts?
May I check - is it possible to specify coordinates relative to the prompt window only, and is this independent of what resolution OR font scaling the computer uses?boiler wrote: ↑20 Jun 2021, 07:49I didn’t answer this question yet because I use Outlook but not Teams, so I was seeing if someone who does might reply.
Instead of using WinClose, you should be able to have it click the desired button, which should dismiss or join as applicable. I haven’t tried ControlClick, but that would be best — if it works on these windows. Apparently sending keyboard shortcuts wouldn’t work. Worst case, you could Click the buttons by known location or by found image location.
I tried controlclick, but think it doesn't detect the underlined A in All :
- Attachments
-
- image.png (19.61 KiB) Viewed 1117 times
Re: How to use AutoHotkey to fix outlook keyboard shortcuts?
Yes, you should only specify coordinates relative to the prompt window, not based on screen coordinates. It would be independent of screen resolution, but I wouldn’t be sure about whether it would work across different Windows scaling settings without testing it. If it does differ by scaling factor, you should be able to scale the coordinates by the ratio of A_ScreenDPI/96.milkygirl90 wrote: ↑ May I check - is it possible to specify coordinates relative to the prompt window only, and is this independent of what resolution OR font scaling the computer uses?
Re: How to use AutoHotkey to fix outlook keyboard shortcuts?
Try using the ControlNN if available (check using the Window Spy tool) instead of the button text.milkygirl90 wrote: ↑ I tried controlclick, but think it doesn't detect the underlined A in All
Last edited by boiler on 20 Jun 2021, 08:07, edited 1 time in total.
- milkygirl90
- Posts: 565
- Joined: 10 Nov 2020, 21:22
Re: How to use AutoHotkey to fix outlook keyboard shortcuts?
Do I just use the Click command with the R modifier for Relative?boiler wrote: ↑20 Jun 2021, 08:03Yes, you should only specify coordinates relative to the prompt window, not based on screen coordinates. It would be independent of screen resolution, but I wouldn’t be sure about whether it would work across different Windows scaling settings without testing it. If it does differ by scaling factor, you should be able to scale the coordinates by the ratio of A_ScreenDPI/96.milkygirl90 wrote: ↑ May I check - is it possible to specify coordinates relative to the prompt window only, and is this independent of what resolution OR font scaling the computer uses?
Also, what's the difference between Client vs Window position?
Code: Select all
Screen: 1029, 538 (less often used)
Window: 1038, 547 (default)
Client: 1029, 538 (recommended)
Color: F0F0F0 (Red=F0 Green=F0 Blue=F0)
- milkygirl90
- Posts: 565
- Joined: 10 Nov 2020, 21:22
Re: How to use AutoHotkey to fix outlook keyboard shortcuts?
It's "Buton 5" in WinSpy, but do I still use the ControlClick command? Sorry as I never used ControlNN before..boiler wrote: ↑20 Jun 2021, 08:06Try using the ControlNN if available (check using the Window Spy tool) instead of the button text.milkygirl90 wrote: ↑ I tried controlclick, but think it doesn't detect the underlined A in All
Re: How to use AutoHotkey to fix outlook keyboard shortcuts?
No, that’s relative to the mouse pointer’s current position which has no correlation to the window position. It means you need to set CoordMode appropriately: CoordMode, Mouse, Relative or Window or Client. If you use Client, then get the coordinates as shown for Client in the Spy tool.milkygirl90 wrote: ↑ Do I just use the Click command with the R modifier for Relative?
Window position is relative to the upper-left corner of the overall window. The client area is the area inside any caption (title bar) and border the window has.milkygirl90 wrote: ↑ Also, what's the difference between Client vs Window position?
Re: How to use AutoHotkey to fix outlook keyboard shortcuts?
It’s actually Button5 with two t’s and no space. It must be exact. It would be like this:milkygirl90 wrote: ↑20 Jun 2021, 08:10It's "Buton 5" in WinSpy, but do I still use the ControlClick command? Sorry as I never used ControlNN before..
Code: Select all
ControlClick, Button5, Reminder(s) ahk_class #32770 ahk_exe OUTLOOK.EXE
Btw, I mistakenly said ControlNN instead of ClassNN.
- milkygirl90
- Posts: 565
- Joined: 10 Nov 2020, 21:22
Re: How to use AutoHotkey to fix outlook keyboard shortcuts?
pardon my ignorance.. I just tested it and I have no idea why the cursor misses the exact coordinates and ends up higher than I'd like:boiler wrote: ↑20 Jun 2021, 08:13No, that’s relative to the mouse pointer’s current position which has no correlation to the window position. It means you need to set CoordMode appropriately: CoordMode, Mouse, Relative or Window or Client. If you use Client, then get the coordinates as shown for Client in the Spy tool.milkygirl90 wrote: ↑ Do I just use the Click command with the R modifier for Relative?
Window position is relative to the upper-left corner of the overall window. The client area is the area inside any caption (title bar) and border the window has.milkygirl90 wrote: ↑ Also, what's the difference between Client vs Window position?
Code: Select all
CoordMode, Mouse, Client
a::Click, 530,371
Re: How to use AutoHotkey to fix outlook keyboard shortcuts?
Was the Reminder(s) window the active window when you pressed the hotkey? Using Relative, Window, or Client positioning is relative to the window that is active at the time that you use Click. Try this:
It’s better to use ControlClick if that works.
Code: Select all
CoordMode, Mouse, Client
a::
WinActivate, Reminder(s) ahk_class #32770 ahk_exe OUTLOOK.EXE
Click, 530,371
return
It’s better to use ControlClick if that works.
- milkygirl90
- Posts: 565
- Joined: 10 Nov 2020, 21:22
Re: How to use AutoHotkey to fix outlook keyboard shortcuts?
ControlClick only highlights the button, and I still have to send a {Enter} to hit the button.. not sure why.boiler wrote: ↑20 Jun 2021, 08:29Was the Reminder(s) window the active window when you pressed the hotkey? Using Relative, Window, or Client positioning is relative to the window that is active at the time that you use Click. Try this:Code: Select all
CoordMode, Mouse, Client a:: WinActivate, Reminder(s) ahk_class #32770 ahk_exe OUTLOOK.EXE Click, 530,371 return
It’s better to use ControlClick if that works.
For the client position, yes the window was active and I used the exact coordinates, but the mouse cursor still missed the button.
Re: How to use AutoHotkey to fix outlook keyboard shortcuts?
Then you should be able to follow the ControlClick with ControlSend to send {Enter} and not have to click by position.
- milkygirl90
- Posts: 565
- Joined: 10 Nov 2020, 21:22
Re: How to use AutoHotkey to fix outlook keyboard shortcuts?
yes it works.. just wanted to understand why controlClick doesn't just click and instead requires another step..boiler wrote: ↑21 Jun 2021, 20:06Then you should be able to follow the ControlClick with ControlSend to send {Enter} and not have to click by position.
Re: How to use AutoHotkey to fix outlook keyboard shortcuts?
It’s just a quirk of that particular control for that window. That’s the nature of this type of automation. It often requires some trial and error. Programs aren’t typically developed with the idea that they should behave normally when a script simulates the actions of a human user, and the various techniques are not the same as human clicking a mouse or whatever, so there is no guarantee that they will produce the same result.
Sometimes a ControlClick alone will work, sometimes the control responds if you focus it before clicking (perhaps that would also be the case here), sometimes the window must be active for anything to work, sometimes the mouse pointer actually needs to be over the target window for any type of click to work, etc.
Sometimes a ControlClick alone will work, sometimes the control responds if you focus it before clicking (perhaps that would also be the case here), sometimes the window must be active for anything to work, sometimes the mouse pointer actually needs to be over the target window for any type of click to work, etc.