run Microsoft apps from the Microsoft store Topic is solved

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
User avatar
boiler
Posts: 16925
Joined: 21 Dec 2014, 02:44

Re: run Microsoft apps from the Microsoft store

Post by boiler » 29 Mar 2023, 15:09

Then it seems to be what you proposed is the problem. You might try running the script as administrator, or use one of the other methods mentioned in the FAQ answer regarding UAC.

wlashack
Posts: 39
Joined: 25 Aug 2019, 01:28

Re: run Microsoft apps from the Microsoft store

Post by wlashack » 29 Mar 2023, 15:12

Thanks for advice and support. I take a look at FAQ you linked and let know.

wlashack
Posts: 39
Joined: 25 Aug 2019, 01:28

Re: run Microsoft apps from the Microsoft store

Post by wlashack » 30 Mar 2023, 14:48

I read the linked FAQ (by my non-codie eyes and mind) and if I understood it well, the possible solution is to set the AHK Launcher to „Run all scripts with a specific interpreter" which i set to be "C:\Program Files\AutoHotkey\v2\AutoHotkey64_UIA.exe". I did that but it did not help.

Following code for launching WhatsApp which is installed from Microsoft Store does nothing:

Code: Select all

#w:: {
	loop Files, A_ProgramFiles "\WindowsApps\WhatsApp.exe", "R" {
		MsgBox '"' A_LoopFileFullPath '"'
		break
	}
}
P.S:: My .ahk script is in Startup directory so it is launched automatically when Windows 11 start. I do not know if this fact has some impact on the way the script is launched or not.

Any advice, how to make it work?

User avatar
boiler
Posts: 16925
Joined: 21 Dec 2014, 02:44

Re: run Microsoft apps from the Microsoft store

Post by boiler » 30 Mar 2023, 15:21

I would first try right-clicking on your script file in File Explorer and select "Run as administrator" and see if that works, even if that's not necessarily your long-term solution given the cautions in the FAQ regarding running a script as administrator.

wlashack
Posts: 39
Joined: 25 Aug 2019, 01:28

Re: run Microsoft apps from the Microsoft store

Post by wlashack » 30 Mar 2023, 15:32

It works! If I rightclick the script and select Run as Administrator“, following code launches WhatsApp:

Code: Select all

#w:: {
	loop Files, A_ProgramFiles "\WindowsApps\WhatsApp.exe", "R" {
		Run '"' A_LoopFileFullPath '"' ; best to surround it in quotes in case there are spaces in the path
		break
	}
}
So how to make it work automatically?

User avatar
boiler
Posts: 16925
Joined: 21 Dec 2014, 02:44

Re: run Microsoft apps from the Microsoft store

Post by boiler » 30 Mar 2023, 18:18

You can have your script automatically run itself as administrator by adding the code to the top of your script that is shown here. But remember as the FAQ points out:
Note that this also causes any programs launched by the script to run as administrator, and may require the user to accept an approval prompt when launching the script.

wlashack
Posts: 39
Joined: 25 Aug 2019, 01:28

Re: run Microsoft apps from the Microsoft store

Post by wlashack » 31 Mar 2023, 03:29

Thank you all a lot! It finally works and I was also able to transform all my AHK shortcuts from v1 to v2. 👍

Post Reply

Return to “Ask for Help (v2)”