mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-26 18:03:35 +01:00
Update close-notepad-app.ps1
This commit is contained in:
parent
6f1b4bbcd7
commit
c754bae0bf
@ -28,7 +28,7 @@ Computer, open `name` browser
|
|||||||
Computer, open `name` app
|
Computer, open `name` app
|
||||||
--------------------------
|
--------------------------
|
||||||
* this launches the given application.
|
* this launches the given application.
|
||||||
* replace `name` by: "Calculator", "Git Extensions", "Netflix", "Spotify", "Thunderbird", or "Visual Studio".
|
* replace `name` by: "Calculator", "Git Extensions", "Netflix", "Notepad", "Spotify", "Thunderbird", or "Visual Studio".
|
||||||
* when finished use: *Computer, close `name` app* to stop the application.
|
* when finished use: *Computer, close `name` app* to stop the application.
|
||||||
|
|
||||||
|
|
||||||
|
@ -11,9 +11,5 @@
|
|||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
#>
|
#>
|
||||||
|
|
||||||
TaskKill /im Notepad
|
& "$PSScriptRoot/close-program.ps1" "Notepad" "notepad" "notepad"
|
||||||
if ($lastExitCode -ne "0") {
|
|
||||||
& "$PSScriptRoot/speak-english.ps1" "Sorry, Notepad is already closed."
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
|
@ -36,7 +36,6 @@ try {
|
|||||||
start-sleep -milliseconds 100
|
start-sleep -milliseconds 100
|
||||||
stop-process -name $ProgramName -force -errorAction 'silentlycontinue'
|
stop-process -name $ProgramName -force -errorAction 'silentlycontinue'
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$Processes = get-process -name $ProgramAliasName -errorAction 'silentlycontinue'
|
$Processes = get-process -name $ProgramAliasName -errorAction 'silentlycontinue'
|
||||||
if ($Processes.Count -eq 0) {
|
if ($Processes.Count -eq 0) {
|
||||||
throw "$FullProgramName is not started yet"
|
throw "$FullProgramName is not started yet"
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
<#
|
|
||||||
.SYNOPSIS
|
|
||||||
Minimizes the Notepad app
|
|
||||||
.DESCRIPTION
|
|
||||||
This script minimizes the Notepad application.
|
|
||||||
.EXAMPLE
|
|
||||||
PS> ./minimize-notepad-app
|
|
||||||
.NOTES
|
|
||||||
Author: Markus Fleschutz · License: CC0
|
|
||||||
.LINK
|
|
||||||
https://github.com/fleschutz/PowerShell
|
|
||||||
#>
|
|
||||||
|
|
||||||
get-process Notepad | Set-WindowStyle -Style Minimize
|
|
||||||
exit 0 # success
|
|
Loading…
Reference in New Issue
Block a user