From 589ba8e93c62794b74e5927f57c76d30eae07af0 Mon Sep 17 00:00:00 2001 From: Markus Fleschutz Date: Mon, 6 Dec 2021 15:46:02 +0100 Subject: [PATCH] Add give-reply.ps1 --- Data/Abbr/Aviation.csv | 21 ++++++++++++++++++++- Docs/VoiceControl.md | 5 +++-- Scripts/give-reply.ps1 | 33 +++++++++++++++++++++++++++++++++ Scripts/say-hello.ps1 | 20 ++++++++++++++++++++ 4 files changed, 76 insertions(+), 3 deletions(-) create mode 100644 Scripts/give-reply.ps1 create mode 100644 Scripts/say-hello.ps1 diff --git a/Data/Abbr/Aviation.csv b/Data/Abbr/Aviation.csv index 412edd5f..70c01845 100644 --- a/Data/Abbr/Aviation.csv +++ b/Data/Abbr/Aviation.csv @@ -1,8 +1,22 @@ Abbreviation,Definition +A/A,Air to air TACAN function +A/C,Aircraft +A/D,Aerodrome +A/F,Autofeather +A/FD,Airport/Facility Directory +A/P,Autopilot +AAE,Above Aerodrome Elevation +AAIB,Air Accidents Investigation Branch (UK) +AAIM,Aircraft Autonomous Integrity Monitoring +AAO,Assumed Adverse Obstacle +AAS,Airport Advisory Service AB,Air Base AC,Aircraft +AC,Air Conditioning +ACAM,Aircraft Continuing Airworthiness Monitoring +ACARS,ARINC Communications Addressing and Reporting System ACAS,Airborne Collision Avoidance System -ACC,Area Control Centre +ACC,Area Control Center ADAC,Abu Dhabi Airports ADP,Aeroportes de Paris AENA,Aeropuertos Españoles y Navegación Aérea @@ -19,6 +33,11 @@ AFM,Airplane Flight Manual AGL,Above Ground Level AIP,Aeronautical Information Publication ANSP,Air Navigation Service Provider +AR,Aerial Refueling +AR,Aspect Ratio +A/R,Altitude Rate +ARFOR,Area Forecast +ARINC,Aeronautical Radio Incorporated (USA) ARTCC,Air Route Traffic Control Centre ASB,Airspace Block ATA,Actual Time of Arrival diff --git a/Docs/VoiceControl.md b/Docs/VoiceControl.md index 0c9f84b0..620bb643 100644 --- a/Docs/VoiceControl.md +++ b/Docs/VoiceControl.md @@ -103,9 +103,10 @@ Lets the computer check something, replace [name] by: `Bitcoin`, `Christmas`, `C * `Computer, tell quote` -💬 Conversation Commands -------------------------- +💬 Welcome & Farewell +--------------------- * `Computer, Hi` +* `Computer, say hello` * `Computer, good morning` * `Computer, good evening` * `Computer, good night` diff --git a/Scripts/give-reply.ps1 b/Scripts/give-reply.ps1 new file mode 100644 index 00000000..8b9c46a8 --- /dev/null +++ b/Scripts/give-reply.ps1 @@ -0,0 +1,33 @@ +<# +.SYNOPSIS + Gives a reply +.DESCRIPTION + This script gives a reply in English by text-to-speech (TTS). +.PARAMETER text + Specifies the text to speak +.EXAMPLE + PS> ./give-reply "Hello World" +.NOTES + Author: Markus Fleschutz · License: CC0 +.LINK + https://github.com/fleschutz/PowerShell +#> + +param([string]$text = "") + +try { + "📣$text" + + $TTSVoice = New-Object -ComObject SAPI.SPVoice + foreach ($Voice in $TTSVoice.GetVoices()) { + if ($Voice.GetDescription() -like "*- English*") { + $TTSVoice.Voice = $Voice + [void]$TTSVoice.Speak($text) + exit 0 # success + } + } + exit 0 # success +} catch { + "⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))" + exit 1 +} diff --git a/Scripts/say-hello.ps1 b/Scripts/say-hello.ps1 new file mode 100644 index 00000000..551e7725 --- /dev/null +++ b/Scripts/say-hello.ps1 @@ -0,0 +1,20 @@ +<# +.SYNOPSIS + Replies to "Say hello" +.DESCRIPTION + This script replies to "Say hello" by text-to-speech (TTS). +.EXAMPLE + PS> ./say-hello +.NOTES + Author: Markus Fleschutz · License: CC0 +.LINK + https://github.com/fleschutz/PowerShell +#> + +try { + & "$PSScriptRoot/give-reply.ps1" "Hello, everyone." + exit 0 # success +} catch { + "⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))" + exit 1 +}