Sign in to follow this  
Followers 0
onefish

Get AUMID of any app?

4 posts in this topic

I am compiling an AutoIT script which does several things, one of which is run and Windows camera app on a couple Win10 tablets. I can run the app using the following code:

ShellExecute("explorer.exe", "shell:AppsFolder\Microsoft.WindowsCamera_8wekyb3d8bbwe!App")

As mentioned, I have 2x tablets and strangely the AUMID for the camera app is the same for both of them but I'm not sure if it will always be that way (updates, etc). Hence, it just seems wrong to hard code the app AUMID into the script and I would much prefer to have the script fetch it each time it runs, therefore guaranteeing that the correct one is always used.

I've tried Microsoft's advice HERE for the command line reg query and it returns the AUMID of the default browser. There is a registry key named AppsFolder\Microsoft.WindowsCamera_8wekyb3d8bbwe in the location outlined in the above link but there is no value set.

Does anyone know the best way to reliably retrieve the AUMID of a specific app within an AutoIT script?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I've been playing around with RegEnumKey and the below script returns the correct string in the $sSubKey variable.

#include <Constants.au3>

Local $sSubKey = ""
Local $i = 1
Local $AUMIDPart = "Microsoft.WindowsCamera"

While 1
    $sSubKey = RegEnumKey("HKEY_CURRENT_USER\Software\Classes\ActivatableClasses\Package", $i)
    If @error Then
        MsgBox($MB_SYSTEMMODAL,"ERROR", "Subkey does not exist")
        Exit
        EndIf
    If StringRegExp($sSubKey, $AUMIDPart) = 1 Then ExitLoop
    $i = $i + 1
WEnd

MsgBox($MB_SYSTEMMODAL,"Subkey "&$i,"""shell:AppsFolder\"&$sSubKey&"!App""")

Is this the best way to go, or is there a better way than looping through the registry subkey?

Edited by onefish

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Perhaps I'm the only person that has need to open Windows modern apps using AutoIT? Or (quite possibly) I have just made this task into something bigger than it needs to be. Would any Win10 tablet PC owners (Surface Pro 3/4 or similar) out there be willing to run the below code and report back what their AUMID for the camera app is? If it's the same as mine then I've definitely made things too complicated and I'll just hard code it. I imagine at some point a function will be added to AutoIT to run modern apps as the old fashioned "Run" just doesn't do it anymore.

---------------------EDIT--------------------------

Code removed, better solution found in the next post.

Edited by onefish

Share this post


Link to post
Share on other sites

VIOLA! I was definitely making this WAAAAAY more complicated than it needed to be. Thanks to a very good tip from sumtips the AutoIT run function does work when the modern app's URL protocol is used, and without having to find its AUMID. The below code opens the Windows 10 camera app. It also restores the camera window after it's been minimized. I couldn't get the maximize flag to work with modern apps once the window has been minimized, but using the run function again doesn't appear to start a second instance of the process (might need to check that a bit more though).

run("explorer.exe microsoft.windows.camera:")

I hope this mono-thread helps someone out there. :D

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0