mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-02-23 05:01:37 +01:00
Add repeat-last-reply.ps1
This commit is contained in:
parent
1383261c68
commit
bdde4f31df
@ -101,6 +101,7 @@ Lets the computer check something, replace [name] by: `Bitcoin`, `Christmas`, `C
|
||||
* `Computer, locate my phone`
|
||||
* `Computer, tell joke`
|
||||
* `Computer, tell quote`
|
||||
* `Computer, repeat last reply`
|
||||
|
||||
|
||||
💬 Welcome & Farewell
|
||||
|
@ -1,8 +1,8 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Answers to 'bye bye'
|
||||
Replies to 'bye bye'
|
||||
.DESCRIPTION
|
||||
This script says a reply to "bye bye" by text-to-speech (TTS).
|
||||
This script says a reply to 'bye bye' by text-to-speech (TTS).
|
||||
.EXAMPLE
|
||||
PS> ./bye-bye
|
||||
.NOTES
|
||||
@ -13,6 +13,5 @@
|
||||
|
||||
$Reply = "Good bye.", "See you.", "Bye bye." | Get-Random
|
||||
|
||||
"$Reply"
|
||||
& "$PSScriptRoot/speak-english.ps1" "$Reply"
|
||||
& "$PSScriptRoot/give-reply.ps1" "$Reply"
|
||||
exit 0 # success
|
||||
|
@ -11,10 +11,5 @@
|
||||
https://github.com/fleschutz/PowerShell
|
||||
#>
|
||||
|
||||
try {
|
||||
& "$PSScriptRoot/speak-english.ps1" "Earth still spins with 1040mph."
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
|
||||
exit 1
|
||||
}
|
||||
& "$PSScriptRoot/give-reply.ps1" "Earth still spins with 1040mph."
|
||||
exit 0 # success
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
TaskKill /im Calculator.exe /f /t
|
||||
if ($lastExitCode -ne "0") {
|
||||
& "$PSScriptRoot/speak-english.ps1" "Sorry, calculator isn't running."
|
||||
& "$PSScriptRoot/give-reply.ps1" "Sorry, calculator isn't running."
|
||||
exit 1
|
||||
}
|
||||
exit 0 # success
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
TaskKill /im msedge.exe /f /t
|
||||
if ($lastExitCode -ne "0") {
|
||||
& "$PSScriptRoot/speak-english.ps1" "Sorry, Microsoft Edge isn't running."
|
||||
& "$PSScriptRoot/give-reply.ps1" "Sorry, Microsoft Edge isn't running."
|
||||
exit 1
|
||||
}
|
||||
exit 0 # success
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
TaskKill /im GitExtensions.exe
|
||||
if ($lastExitCode -ne "0") {
|
||||
& "$PSScriptRoot/speak-english.ps1" "Sorry, Git Extensions isn't running."
|
||||
& "$PSScriptRoot/give-reply.ps1" "Sorry, Git Extensions isn't running."
|
||||
exit 1
|
||||
}
|
||||
exit 0 # success
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
TaskKill /im mspaint.exe
|
||||
if ($lastExitCode -ne "0") {
|
||||
& "$PSScriptRoot/speak-english.ps1" "Sorry, Microsoft Paint isn't running."
|
||||
& "$PSScriptRoot/give-reply.ps1" "Sorry, Microsoft Paint isn't running."
|
||||
exit 1
|
||||
}
|
||||
exit 0 # success
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
TaskKill /im WinStore.App.exe /f /t
|
||||
if ($lastExitCode -ne "0") {
|
||||
& "$PSScriptRoot/speak-english.ps1" "Sorry, Microsoft Store isn't running."
|
||||
& "$PSScriptRoot/give-reply.ps1" "Sorry, Microsoft Store isn't running."
|
||||
exit 1
|
||||
}
|
||||
exit 0 # success
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
TaskKill /im obs64.exe
|
||||
if ($lastExitCode -ne "0") {
|
||||
& "$PSScriptRoot/speak-english.ps1" "Sorry, OBS Studio isn't running"
|
||||
& "$PSScriptRoot/give-reply.ps1" "Sorry, OBS Studio isn't running"
|
||||
exit 1
|
||||
}
|
||||
exit 0 # success
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
TaskKill /f /im CalendarApp.Gui.Win10.exe
|
||||
if ($lastExitCode -ne "0") {
|
||||
& "$PSScriptRoot/speak-english.ps1" "Sorry, OneCalendar isn't running."
|
||||
& "$PSScriptRoot/give-reply.ps1" "Sorry, OneCalendar isn't running."
|
||||
exit 1
|
||||
}
|
||||
exit 0 # success
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
TaskKill /im outlook.exe
|
||||
if ($lastExitCode -ne "0") {
|
||||
& "$PSScriptRoot/speak-english.ps1" "Sorry, Microsoft Outlook isn't running."
|
||||
& "$PSScriptRoot/give-reply.ps1" "Sorry, Microsoft Outlook isn't running."
|
||||
exit 1
|
||||
}
|
||||
exit 0 # success
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
TaskKill /im PaintStudio.View.exe /f
|
||||
if ($lastExitCode -ne "0") {
|
||||
& "$PSScriptRoot/speak-english.ps1" "Sorry, Paint 3D isn't running."
|
||||
& "$PSScriptRoot/give-reply.ps1" "Sorry, Paint 3D isn't running."
|
||||
exit 1
|
||||
}
|
||||
exit 0 # success
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
TaskKill /im 3DViewer.exe /f
|
||||
if ($lastExitCode -ne "0") {
|
||||
& "$PSScriptRoot/speak-english.ps1" "Sorry, 3D Viewer isn't running."
|
||||
& "$PSScriptRoot/give-reply.ps1" "Sorry, 3D Viewer isn't running."
|
||||
exit 1
|
||||
}
|
||||
exit 0 # success
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
TaskKill /im thunderbird.exe
|
||||
if ($lastExitCode -ne "0") {
|
||||
& "$PSScriptRoot/speak-english.ps1" "Sorry, Mozilla Thunderbird isn't running."
|
||||
& "$PSScriptRoot/give-reply.ps1" "Sorry, Mozilla Thunderbird isn't running."
|
||||
exit 1
|
||||
}
|
||||
exit 0 # success
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
TaskKill /im devenv.exe
|
||||
if ($lastExitCode -ne "0") {
|
||||
& "$PSScriptRoot/speak-english.ps1" "Sorry, Visual Studio isn't running."
|
||||
& "$PSScriptRoot/give-reply.ps1" "Sorry, Visual Studio isn't running."
|
||||
exit 1
|
||||
}
|
||||
exit 0 # success
|
||||
|
@ -13,6 +13,5 @@
|
||||
|
||||
$Reply = "I'm fine, thanks. How are you?", "I'm fine, maybe a little tired. I need some more coffee.", "Great, thank you. How are you?", "Good, thanks, and you?", "Fine, thanks. How are you?" | Get-Random
|
||||
|
||||
"$Reply"
|
||||
& "$PSScriptRoot/speak-english.ps1" "$Reply"
|
||||
& "$PSScriptRoot/give-reply.ps1" "$Reply"
|
||||
exit 0 # success
|
||||
|
@ -1,6 +1,6 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Launches the Git Extensions app
|
||||
Launches Git Extensions
|
||||
.DESCRIPTION
|
||||
This script launches the Git Extensions application.
|
||||
.EXAMPLE
|
||||
@ -11,7 +11,7 @@
|
||||
https://github.com/fleschutz/PowerShell
|
||||
#>
|
||||
|
||||
function TryExec { param($Folder, $Binary)
|
||||
function TryToExec { param($Folder, $Binary)
|
||||
if (test-path "$Folder/$Binary" -pathType leaf) {
|
||||
start-process "$Folder/$Binary" -WorkingDirectory "$Folder"
|
||||
exit 0 # success
|
||||
@ -19,10 +19,10 @@ function TryExec { param($Folder, $Binary)
|
||||
}
|
||||
|
||||
try {
|
||||
TryExec "C:\Program Files (x86)\GitExtensions" "GitExtensions.exe"
|
||||
TryExec "C:\Program Files\GitExtensions" "GitExtensions.exe"
|
||||
& "$PSScriptRoot/speak-english.ps1" "Sorry, I can't find Git Extensions"
|
||||
exit 0 # success
|
||||
TryToExec "C:\Program Files (x86)\GitExtensions" "GitExtensions.exe"
|
||||
TryToExec "C:\Program Files\GitExtensions" "GitExtensions.exe"
|
||||
& "$PSScriptRoot/give-reply.ps1" "Sorry, can't find Git Extensions."
|
||||
exit 1
|
||||
} catch {
|
||||
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
|
||||
exit 1
|
||||
|
22
Scripts/repeat-last-reply.ps1
Normal file
22
Scripts/repeat-last-reply.ps1
Normal file
@ -0,0 +1,22 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Repeats the last reply
|
||||
.DESCRIPTION
|
||||
This repeats the last reply by text-to-speech (TTS).
|
||||
.EXAMPLE
|
||||
PS> ./repeat-last-reply
|
||||
.NOTES
|
||||
Author: Markus Fleschutz · License: CC0
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
#>
|
||||
|
||||
if (test-path "$HOME/.last_reply.txt" -pathType leaft) {
|
||||
$Reply = "OK, I said: "
|
||||
$Reply += Get-Content "$HOME/.last_reply.txt"
|
||||
} else {
|
||||
$Reply = "Sorry, I can't remember."
|
||||
}
|
||||
|
||||
& "$PSScriptRoot/give-reply.ps1" "$Reply"
|
||||
exit 0 # success
|
@ -13,6 +13,5 @@
|
||||
|
||||
$Reply = "Good bye.", "See you.", "Bye bye." | Get-Random
|
||||
|
||||
"$Reply"
|
||||
& "$PSScriptRoot/speak-english.ps1" "$Reply"
|
||||
& "$PSScriptRoot/give-reply.ps1" "$Reply"
|
||||
exit 0 # success
|
||||
|
@ -25,8 +25,7 @@ try {
|
||||
if ($Line -like "HEAD*") { & "$PSScriptRoot/write-big.ps1" "$($Line.substring(5))"; continue }
|
||||
|
||||
""
|
||||
"($Step) $Line"
|
||||
& "$PSScriptRoot/speak-english.ps1" "$Line"
|
||||
& "$PSScriptRoot/give-reply.ps1" "$($Step). $Line"
|
||||
$Dummy = read-host " Say <Check> or press <Return> to continue"
|
||||
$Step++
|
||||
}
|
||||
|
@ -17,10 +17,10 @@ param([int]$StartNumber = 10)
|
||||
|
||||
try {
|
||||
for ([int]$i = $StartNumber; $i -gt 0; $i--) {
|
||||
& "$PSScriptRoot/speak-english.ps1" $i
|
||||
& "$PSScriptRoot/give-reply.ps1" $i
|
||||
start-sleep -milliseconds 200
|
||||
}
|
||||
& "$PSScriptRoot/speak-english.ps1" "zero"
|
||||
& "$PSScriptRoot/give-reply.ps1" "zero"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
|
||||
|
@ -16,10 +16,9 @@ try {
|
||||
|
||||
$Generator = New-Object System.Random
|
||||
$Index = [int]$Generator.next(0, $Table.Count - 1)
|
||||
$Answer = $Table[$Index].Joke
|
||||
$Reply = $Table[$Index].Joke
|
||||
|
||||
& "$PSScriptRoot/speak-english.ps1" "$Answer"
|
||||
write-output "$Answer"
|
||||
& "$PSScriptRoot/give-reply.ps1" "$Reply"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
|
||||
|
@ -18,10 +18,9 @@ try {
|
||||
$Index = [int]$Generator.next(0, $Table.Count - 1)
|
||||
$Quote = $Table[$Index].Quote
|
||||
$Author = $Table[$Index].Author
|
||||
$Answer = "$Quote (by $Author)"
|
||||
$Reply = "$Quote (by $Author)"
|
||||
|
||||
& "$PSScriptRoot/speak-english.ps1" "$Answer"
|
||||
write-output "$Answer"
|
||||
& "$PSScriptRoot/give-reply.ps1" "$Reply"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
|
||||
|
@ -20,8 +20,7 @@ try {
|
||||
for ([int]$i = 0; $i -lt $percent; $i += 2) {
|
||||
$obj.SendKeys([char]174) # each tick is -2%
|
||||
}
|
||||
"🔉️ -$($percent)%"
|
||||
& "$PSScriptRoot/speak-english.ps1" "$percent percent less volume"
|
||||
& "$PSScriptRoot/give-reply.ps1" "$($percent)% less volume"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
|
||||
|
@ -20,8 +20,7 @@ try {
|
||||
for ([int]$i = 0; $i -lt $percent; $i += 2) {
|
||||
$obj.SendKeys([char]175) # each tick is +2%
|
||||
}
|
||||
"🔊️ +$($percent)%"
|
||||
& "$PSScriptRoot/speak-english.ps1" "$percent percent louder"
|
||||
& "$PSScriptRoot/give-reply.ps1" "$($percent)% more volume"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
|
||||
|
Loading…
Reference in New Issue
Block a user