[solved] How to detect Calculator on Windows 10

Get help with using AutoHotkey and its commands and hotkeys
mkanet
Posts: 3
Joined: 19 Aug 2019, 16:51

Re: [solved] How to detect Calculator on Windows 10

19 Aug 2019, 17:00

Would someone please be kind enough to provide a working example to detect the OneNote UWP app? Im trying to activate/restore a minimized OneNote (UWP) app. I tried replacing the process name with "onenoteim.exe" in the example provided in this thread that's supposed to be working, but the app is still not detected. When searching on google, there seems to be very little information for manipulating UWP apps on Windows using AutoHotKey; even though these apps have been around for years.
User avatar
GollyJer
Posts: 59
Joined: 19 Sep 2015, 19:33
GitHub: GollyJer

Re: [solved] How to detect Calculator on Windows 10

19 Aug 2019, 19:51

It's definitely not easy to work with these type of apps.

For OneNote I've simply using this command.

Code: Select all

Run, % "onenote:"
It will open OneNote if it's closed and bring it to the foreground if it's minimized or in the background. Working with OneNote beyond that is pretty hard though.
mkanet
Posts: 3
Joined: 19 Aug 2019, 16:51

Re: [solved] How to detect Calculator on Windows 10

20 Aug 2019, 21:50

Thanks for the reply back. Actually Run, % "onenote:" starts the obsolete Win32 version of OneNote (aka OneNote 2016), not the UWP version. I can launch the UWP version of this app via the below command-line; however, I don't know how to restore it from a minimized state using AHK.

Code: Select all

explorer "shell:appsFolder\Microsoft.Office.OneNote_8wekyb3d8bbwe!microsoft.onenoteim"
I can even resize and position the app using AHK (after I launch it using the above Windows command-line).
GollyJer wrote:
19 Aug 2019, 19:51
It's definitely not easy to work with these type of apps.

For OneNote I've simply using this command.

Code: Select all

Run, % "onenote:"
It will open OneNote if it's closed and bring it to the foreground if it's minimized or in the background. Working with OneNote beyond that is pretty hard though.
lexikos
Posts: 6653
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: [solved] How to detect Calculator on Windows 10

21 Aug 2019, 03:43

Can OneNote 2016 be removed?

On my system onenote: launches the UWP app or restores it if minimized. But I am on an Insider build (18362.10012) and do not have any other version of OneNote installed.

You can probably choose which OneNote app is associated with the onenote: "protocol" by opening Settings, Default apps, Choose default applications by protocol, and finding "ONENOTE".

If you want to restore the minimized OneNote window, you just need to identify it correctly. Onenoteim.exe creates at least two windows, both "visible", but you can only see one of them. You can confirm which window a given WinTitle matches by using commands like WinGetTitle, WinGetClass and WinGet ID. To be more specific with the WinTitle, you can get details from Window Spy.

For instance, there were multiple examples with Calculator ahk_class ApplicationFrameWindow earlier in this thread. This window class is common to all UWP apps, and generally indicates an actual window the user can interact with.
GollyJer wrote:Maybe multiple criteria in WinExist is new since this post was created?
Nope.
mkanet
Posts: 3
Joined: 19 Aug 2019, 16:51

Re: [solved] How to detect Calculator on Windows 10

07 Sep 2019, 00:07

Thank you so much for the tip. You were right, I had to point the Win10 association protocol to the UWP version of the app. onenote: takes care of the only issue I had!

I didn't see a way to uninstall the OneNote 2016 app. I'm guessing that it will automatically be removed when Office is updated to the next version on my machine.
lexikos wrote:
21 Aug 2019, 03:43
Can OneNote 2016 be removed?

On my system onenote: launches the UWP app or restores it if minimized. But I am on an Insider build (18362.10012) and do not have any other version of OneNote installed.

You can probably choose which OneNote app is associated with the onenote: "protocol" by opening Settings, Default apps, Choose default applications by protocol, and finding "ONENOTE".

If you want to restore the minimized OneNote window, you just need to identify it correctly. Onenoteim.exe creates at least two windows, both "visible", but you can only see one of them. You can confirm which window a given WinTitle matches by using commands like WinGetTitle, WinGetClass and WinGet ID. To be more specific with the WinTitle, you can get details from Window Spy.

For instance, there were multiple examples with Calculator ahk_class ApplicationFrameWindow earlier in this thread. This window class is common to all UWP apps, and generally indicates an actual window the user can interact with.
GollyJer wrote:Maybe multiple criteria in WinExist is new since this post was created?
Nope.

Return to “Ask For Help”

Who is online

Users browsing this forum: catdog557, Google [Bot], maxkill, Odlanir, Scoox, Stario, ulraf and 203 guests