From 5fb1f52acec3858724c0c7e0c628d3d77c48f574 Mon Sep 17 00:00:00 2001 From: Markus Fleschutz Date: Thu, 9 Dec 2021 15:45:03 +0100 Subject: [PATCH] Add open-apps-folder.ps1 --- Docs/VoiceControl.md | 2 +- Scripts/open-apps-folder.ps1 | 16 ++++++++++++++++ Scripts/open-firefox-browser.ps1 | 9 ++++++++- 3 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 Scripts/open-apps-folder.ps1 diff --git a/Docs/VoiceControl.md b/Docs/VoiceControl.md index 8b4c8333..e0453094 100644 --- a/Docs/VoiceControl.md +++ b/Docs/VoiceControl.md @@ -46,7 +46,7 @@ When finished say: "Computer, close file explorer" to close the File Explorer. `Computer, open` [name] `folder` -------------------------------- -Launches the File Explorer with the given folder - replace [name] by: `autostart`, `desktop`, `documents`, `downloads`, `Dropbox`, `home`, `music`, `OneDrive`, `pictures`, `recycle bin`, `repos`, `temporary`, or `videos`. +Launches the File Explorer with the given folder - replace [name] by: `apps`, `autostart`, `desktop`, `documents`, `downloads`, `Dropbox`, `home`, `music`, `OneDrive`, `pictures`, `recycle bin`, `repos`, `temporary`, or `videos`. When finished say: "Computer, close file explorer" to close the File Explorer. diff --git a/Scripts/open-apps-folder.ps1 b/Scripts/open-apps-folder.ps1 new file mode 100644 index 00000000..e4a15569 --- /dev/null +++ b/Scripts/open-apps-folder.ps1 @@ -0,0 +1,16 @@ +<# +.SYNOPSIS + Opens the Apps folder +.DESCRIPTION + This script launches the File Explorer showing the UWP apps folder. +.EXAMPLE + PS> ./open-apps-folder +.NOTES + Author: Markus Fleschutz · License: CC0 +.LINK + https://github.com/fleschutz/PowerShell +#> + +& "$PSScriptRoot/open-file-explorer.ps1" "shell:AppsFolder" +exit 0 # success + diff --git a/Scripts/open-firefox-browser.ps1 b/Scripts/open-firefox-browser.ps1 index c5afe210..5f08dd00 100755 --- a/Scripts/open-firefox-browser.ps1 +++ b/Scripts/open-firefox-browser.ps1 @@ -16,7 +16,14 @@ param([string]$URL = "http://www.fleschutz.de") try { - start-process firefox.exe "$URL" + $App = Get-AppxPackage -Name Mozilla.FireFox + if ($App.Status -eq "Ok") { + # starting Firefox UWP app: + explorer.exe shell:appsFolder\$($App.PackageFamilyName)!FIREFOX + } else { + # starting Firefox program: + start-process firefox.exe "$URL" + } exit 0 # success } catch { "⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"