run Microsoft apps from the Microsoft store Topic is solved
run Microsoft apps from the Microsoft store
Hello,
I’m trying to assign keyboard shortcuts to run Microsoft applications (from the store downloaded), for example WhatsApp, which is now a Microsoft Store application and not a standalone installation as it was previously.
But there is no way to find a way to start it with a keyboard shortcut other than clicking on its icon from the start menu.
This is the location where it’s installed C:\PROGRAM FILES\WINDOWSAPPS\5319275A.WHATSAPPDESKTOP_2.2310.3.0_X64__CV1G1GVANYJGM yet the exe which resides there doesn’t run!
Run "WhatsApp" does also nothing although in the past I could run it with this command.
Thanks
I’m trying to assign keyboard shortcuts to run Microsoft applications (from the store downloaded), for example WhatsApp, which is now a Microsoft Store application and not a standalone installation as it was previously.
But there is no way to find a way to start it with a keyboard shortcut other than clicking on its icon from the start menu.
This is the location where it’s installed C:\PROGRAM FILES\WINDOWSAPPS\5319275A.WHATSAPPDESKTOP_2.2310.3.0_X64__CV1G1GVANYJGM yet the exe which resides there doesn’t run!
Run "WhatsApp" does also nothing although in the past I could run it with this command.
Thanks
Re: run Microsoft apps from the Microsoft store Topic is solved
viewtopic.php?p=438517#p438517
Code: Select all
; This script runs an app installed from the Microsoft Store
#Requires AutoHotkey v2.0
F3::SoundBeep(1500), runApp('WhatsApp')
runApp(appName) { ; https://www.autohotkey.com/boards/viewtopic.php?p=438517#p438517
For app in ComObject('Shell.Application').NameSpace('shell:AppsFolder').Items
(app.Name = appName) && RunWait('explorer shell:appsFolder\' app.Path)
}
Re: run Microsoft apps from the Microsoft store
Thanks for answering but this code is far too advanced for my knowledge to edit it properly and adjust it.
I guessed that by changing the appName to WhatsApp and entering the path in the section app.Path : "" it would work but it doesn’t.
If you could adjust it for me, I’d appreciate it.
Thanks
I guessed that by changing the appName to WhatsApp and entering the path in the section app.Path : "" it would work but it doesn’t.
If you could adjust it for me, I’d appreciate it.
Thanks
Re: run Microsoft apps from the Microsoft store
Sure.
1. Run script.
2. Press F3.
1. Run script.
2. Press F3.
Re: run Microsoft apps from the Microsoft store
I have no words to thank you not only for this code but for all questions I posted, and you promptly answered.
The below is working perfectly now thanks to you.
Code: Select all
#+w::
{ ; WhatsApp
If WinExist("ahk_class ApplicationFrameWindow")
If WinActive()
WinMinimize
Else WinActivate
Else
runApp('WhatsApp')
runApp(appName) {
For app in ComObject('Shell.Application').NameSpace('shell:AppsFolder').Items
(app.Name = appName) && RunWait('explorer shell:appsFolder\' app.Path)
}
}
Re: run Microsoft apps from the Microsoft store
You are welcome. A suggestion is below.
Code: Select all
#Requires AutoHotkey v2.0
#+w:: { ; WIN-SHIFT-w = WhatsApp
If WinExist("WhatsApp ahk_class ApplicationFrameWindow")
If WinActive()
WinMinimize(), MouseGetPos(,, &hWnd), WinActivate(hWnd)
Else WinActivate
Else runApp('WhatsApp')
}
runApp(appName) {
For app in ComObject('Shell.Application').NameSpace('shell:AppsFolder').Items
(app.Name = appName) && RunWait('explorer shell:appsFolder\' app.Path)
}
Re: run Microsoft apps from the Microsoft store
Thanks!
It produces the same result.
What’s the difference? I see the MouseGetPos parameter. If I knew what this is for, I would most probably adjust also the scripts that are running the same code for other apps
It produces the same result.
What’s the difference? I see the MouseGetPos parameter. If I knew what this is for, I would most probably adjust also the scripts that are running the same code for other apps
Re: run Microsoft apps from the Microsoft store
The AHK documentation can help you understand any AHK function.
In some cases, minimizing a window does not inactivate it. The revised script will activate the window under the mouse.
You don't need to repeat the code. That is why functions can be created.
In some cases, minimizing a window does not inactivate it. The revised script will activate the window under the mouse.
You don't need to repeat the code. That is why functions can be created.
Code: Select all
#Requires AutoHotkey v2.0
#+w::toggleWindow('WhatsApp', 'WhatsApp ahk_class ApplicationFrameWindow')
F3::toggleWindow(A_WinDir '\System32\notepad.exe', 'ahk_exe notepad.exe')
toggleWindow(appNameOrPath, winTitle) {
If WinExist(winTitle)
If WinActive()
WinMinimize(), MouseGetPos(,, &hWnd), WinActivate(hWnd)
Else WinActivate
Else runApp(appNameOrPath)
}
runApp(appNameOrPath) {
If !FileExist(appNameOrPath) {
For app in ComObject('Shell.Application').NameSpace('shell:AppsFolder').Items
(app.Name = appNameOrPath) && RunWait('explorer shell:appsFolder\' app.Path)
} Else Run(appNameOrPath)
}
Re: run Microsoft apps from the Microsoft store
Oh! I do get the point now. However, with the previous code the window that was minimised was in all scenarios deactivated and the previous window was activated.
But I do see the point and I’ll go through the code you’ve posted to understand its functionality and use it.
Thank you again for your assistance!
But I do see the point and I’ll go through the code you’ve posted to understand its functionality and use it.
Thank you again for your assistance!
Re: run Microsoft apps from the Microsoft store
Hello,
I am not a codie, I am only trying to find a solution of the same situation as described in this thread.
When I copy the code above to my AHK script and try tu run the script, it returns me error, where the "line 88" is the first line of the code copied from two posts above:
What is wrong? Thanks!
I am not a codie, I am only trying to find a solution of the same situation as described in this thread.
When I copy the code above to my AHK script and try tu run the script, it returns me error, where the "line 88" is the first line of the code copied from two posts above:
What is wrong? Thanks!
Re: run Microsoft apps from the Microsoft store
Although the posted script works, and your script does not work, I do not have a magic ball to see what your script is! You could post it in a new reply below.
Re: run Microsoft apps from the Microsoft store
@wlashack, based on your other recent post, it seems you are running AHK v1 (although posted in the v2 forum). The code above is AHK v2, though.
Re: run Microsoft apps from the Microsoft store
Oh my, you are absolutely right. Thanks for the info and sorry for the chaos I made here. Now I look into the help files and finding differences between v1 and v2 syntax etc.
On the other hand, maybe I found a more straightforward solution for launching WhatsApp from Microsoft Store. Here it is:
It works for me pretty well in AHK v2.
Question is what happens when Whatsapp gets an update some day, maybe the link will have to change to another directory.
On the other hand, maybe I found a more straightforward solution for launching WhatsApp from Microsoft Store. Here it is:
Code: Select all
#w::
{
Run "C:\Program Files\WindowsApps\5319275A.WhatsAppDesktop_2.2310.3.0_x64__cv1g1gvanyjgm\WhatsApp.exe"
}
Question is what happens when Whatsapp gets an update some day, maybe the link will have to change to another directory.
Re: run Microsoft apps from the Microsoft store
This will handle changes to the sub-directory due to version updates:
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
}
}
Re: run Microsoft apps from the Microsoft store
Hmm, looks like it does not work for me.
Last edited by wlashack on 28 Mar 2023, 14:35, edited 1 time in total.
Re: run Microsoft apps from the Microsoft store
Or:
Code: Select all
#Requires AutoHotkey v1.1.33
F3::runApp("WhatsApp")
F4::runApp(A_WinDir "\System32\notepad.exe")
runApp(appNameOrPath) {
If !FileExist(appNameOrPath) {
For app in ComObjCreate("Shell.Application").NameSpace("shell:AppsFolder").Items
If (app.Name = appNameOrPath)
RunWait % "explorer shell:appsFolder\" app.Path
} Else Run % appNameOrPath
}
Re: run Microsoft apps from the Microsoft store
That exact script works for me when I change it for an app I have. That was a v2 script, so to make sure you're running v2 when running that script, put this at the top:
Code: Select all
#Requires AutoHotkey v2.0
If it still doesn't work, did you copy, paste, and run it exactly as I posted it, or did you change what you thought needed to be changed by inspection? Did you remember to press the hotkey? What does it show if you run this version?
Code: Select all
#Requires AutoHotkey v2.0
#w:: {
loop Files, A_ProgramFiles "\WindowsApps\WhatsApp.exe", "R" {
MsgBox '"' A_LoopFileFullPath '"'
break
}
}
Re: run Microsoft apps from the Microsoft store
I use the script the exact way it is written here in the latest post above, did not change anything:
After pressing Win+W shortuct, nothing happens.
The path to WhatsApp.exe on my Win11 laptop is:
One possible cause of the problem that comes to my mind is that WindowsApps directory is hidden and can be achieved by admin only. Maybe?
Code: Select all
#Requires AutoHotkey v2.0
#w:: {
loop Files, A_ProgramFiles "\WindowsApps\WhatsApp.exe", "R" {
MsgBox '"' A_LoopFileFullPath '"'
break
}
}
The path to WhatsApp.exe on my Win11 laptop is:
Code: Select all
"C:\Program Files\WindowsApps\5319275A.WhatsAppDesktop_2.2311.3.0_x64__cv1g1gvanyjgm\WhatsApp.exe"
Re: run Microsoft apps from the Microsoft store
Possibly. Try the version below and see if it displays "C:\Program Files\AutoHotkey\UX\ui-dash.ahk", assuming that's where you have AHK installed.
Code: Select all
#Requires AutoHotkey v2.0
#w:: {
loop Files, A_ProgramFiles "\AutoHotkey\ui-dash.ahk", "R" {
MsgBox '"' A_LoopFileFullPath '"'
break
}
}
Note that it finds and displays the full path to the file even though the subfolder UX wasn't in the loop path.
Re: run Microsoft apps from the Microsoft store
Yes, it returns me a message box with the path after pressing Win+w shortcut.