How can I specify Windows Mail in AutoHotKey?

0

I'm trying to remap a couple keys for Windows Mail, but ahk_exe isn't working. I used Process Explorer to find the name of the executable. Here's my script:

#IfWinActive ahk_exe HxMail.exe
f7::f9  ; Refresh
Ins::^n ; New email
#IfWinActive

The window's name is different depending on which account I'm using. How can I fix this?

Zenon

Posted 2017-01-27T19:27:44.077

Reputation: 101

Possibly try disabling (commenting out) the #IfWinActive (i.e., make the hotkeys global temporarily) and make sure the key remaps work as expected. Possibly double-check the window name with Window Spy and not just PE, you can start Window Spy from the right-click menu of the tray icon of your script. Verify the expected exe for a given window. Verify capitalization of the exe is correct in your script. You can also utilize ahk_class in many cases where you need to detect a variety of window names that are the same type of window. – JJohnston2 – 2017-01-29T23:30:06.250

Key remaps worked as expected without #IfWinActive. Window Spy pulled up this: ahk_class ApplicationFrameWindow ahk_exe ApplicationFrameHost.exe. It appears to be the same for all Universal apps. – Zenon – 2017-01-31T17:42:13.037

@JJohnston2 Is there a way to check if the name of the window contains "Mail"? – Zenon – 2017-01-31T17:43:34.500

1#IfWinactive Mail ahk_exe ApplicationFrameworkHost.exe – JJohnston2 – 2017-01-31T17:50:28.110

1No, it will only apply to universal apps with 'Mail' in the title, not all of them. If you need to be more selective there has to be a title or class difference. One final method in lieu of that is to check for a certain control type to be active, if the controls aren't all generic. – JJohnston2 – 2017-02-01T18:07:46.383

Gotcha, but it doesn't work. The title of the window is Inbox - Outlook - Mail. Could it be that the title doesn't start with Mail? – Zenon – 2017-02-02T19:09:26.500

https://www.autohotkey.com/docs/commands/SetTitleMatchMode.htm – JJohnston2 – 2017-02-02T20:21:45.483

Still doesn't work. – Zenon – 2017-02-02T23:23:40.410

No answers