mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-02-02 10:59:14 +01:00
Added close-calculator.ps1
This commit is contained in:
parent
e0d576d662
commit
891548f6b4
@ -3,6 +3,7 @@ check-ipv4-address.ps1, checks the given IPv4 address for validity
|
||||
check-mac-address.ps1, checks the given MAC address for validity
|
||||
check-xml-file.ps1, checks the given XML file for validity
|
||||
clone-repos.ps1, clones well-known Git repositories
|
||||
close-calculator.ps1, closes the calculator program gracefully
|
||||
close-chrome.ps1, closes Google Chrome gracefully
|
||||
close-edge.ps1, closes Microsoft Edge gracefully
|
||||
close-file-explorer.ps1, closes Microsoft File Explorer gracefully
|
||||
|
|
@ -1,7 +1,7 @@
|
||||
Collection of Useful PowerShell Scripts
|
||||
=======================================
|
||||
|
||||
This repository contains 90+ useful and cross-platform PowerShell scripts - to be used by command-line interface (CLI), for remote control (RC), by context menu, by voice control, by automation software (e.g. Jenkins), or simply to learn PowerShell.
|
||||
This repository contains 100+ useful and cross-platform PowerShell scripts - to be used by command-line interface (CLI), for remote control (RC), by context menu, by voice control, by automation software (e.g. Jenkins), or simply to learn PowerShell.
|
||||
|
||||
List of Scripts
|
||||
---------------
|
||||
@ -11,6 +11,7 @@ The following PowerShell scripts can be found in the [Scripts/](Scripts/) subfol
|
||||
* [check-mac-address.ps1](Scripts/check-mac-address.ps1) - checks the given MAC address for validity
|
||||
* [check-xml-file.ps1](Scripts/check-xml-file.ps1) - checks the given XML file for validity
|
||||
* [clone-repos.ps1](Scripts/clone-repos.ps1) - clones well-known Git repositories
|
||||
* [close-calculator.ps1](Scripts/close-calculator.ps1) - closes the calculator program gracefully
|
||||
* [close-chrome.ps1](Scripts/close-chrome.ps1) - closes Google Chrome gracefully
|
||||
* [close-edge.ps1](Scripts/close-edge.ps1) - closes Microsoft Edge gracefully
|
||||
* [close-file-explorer.ps1](Scripts/close-file-explorer.ps1) - closes Microsoft File Explorer gracefully
|
||||
|
9
Scripts/close-calculator.ps1
Normal file
9
Scripts/close-calculator.ps1
Normal file
@ -0,0 +1,9 @@
|
||||
#!/snap/bin/powershell
|
||||
<#
|
||||
.SYNTAX ./close-calculator.ps1
|
||||
.DESCRIPTION closes the calculator program gracefully
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
./close-program "calc" "Calculator"
|
@ -11,7 +11,7 @@ $PathToRepo = "$PSScriptRoot/.."
|
||||
|
||||
try {
|
||||
write-output "Init speech recognition engine..."
|
||||
$null = [Reflection.Assembly]::LoadWithPartialName("System.Speech")
|
||||
[void][System.Reflection.Assembly]::LoadWithPartialName("System.Speech")
|
||||
$speechRecogEng = [System.Speech.Recognition.SpeechRecognitionEngine]::new()
|
||||
#$speechRecogEng.InitialSilenceTimeout = 15
|
||||
$speechRecogEng.SetInputToDefaultAudioDevice()
|
||||
@ -33,6 +33,8 @@ try {
|
||||
$grammar2.Append("exit")
|
||||
$speechRecogEng.LoadGrammar($grammar2)
|
||||
|
||||
write-output "NOTE: make sure the microphone volume is not too silent or too loud!"
|
||||
|
||||
write-output "Listening now ($Count voice commands)..."
|
||||
while ($true) {
|
||||
$recognized = $speechRecogEng.Recognize()
|
||||
|
Loading…
Reference in New Issue
Block a user