mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-21 23:43:25 +01:00
Change to use speak-english.ps1
This commit is contained in:
parent
7c1e83cbd7
commit
fa7823858f
@ -23,7 +23,7 @@ function GetTempDir {
|
||||
}
|
||||
|
||||
try {
|
||||
& "$PSScriptRoot/give-reply.ps1" "Just a second..."
|
||||
& "$PSScriptRoot/speak-english.ps1" "Just a second..."
|
||||
|
||||
$Path = "$(GetTempDir)/next_wallpaper.jpg"
|
||||
& wget -O $Path "https://source.unsplash.com/3840x2160?$Category"
|
||||
|
@ -15,7 +15,7 @@
|
||||
try {
|
||||
[system.threading.thread]::currentthread.currentculture=[system.globalization.cultureinfo]"en-US"
|
||||
$Weekday = (Get-Date -format "dddd")
|
||||
& "$PSScriptRoot/give-reply.ps1" "It's $Weekday."
|
||||
& "$PSScriptRoot/speak-english.ps1" "It's $Weekday."
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
@ -31,7 +31,7 @@ try {
|
||||
exit 1
|
||||
}
|
||||
|
||||
& "$PSScriptRoot/give-reply.ps1" "Drive $Drive has $Free GB left ($Total GB total)"
|
||||
& "$PSScriptRoot/speak-english.ps1" "Drive $Drive has $Free GB left ($Total GB total)"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
@ -35,7 +35,7 @@ try {
|
||||
$TimeSpan = TimeSpanToString($Now - $Dusk)
|
||||
$Reply = "Dusk was $TimeSpan ago at $($Dusk.ToShortTimeString())."
|
||||
}
|
||||
& "$PSScriptRoot/give-reply.ps1" "$Reply"
|
||||
& "$PSScriptRoot/speak-english.ps1" "$Reply"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
@ -16,10 +16,10 @@ try {
|
||||
$Easter = [Datetime]("04/17/2022")
|
||||
if ($Now -lt $Easter) {
|
||||
$Diff = $Easter – $Now
|
||||
& "$PSScriptRoot/give-reply.ps1" "Easter Sunday on April 17 is in $($Diff.Days) days."
|
||||
& "$PSScriptRoot/speak-english.ps1" "Easter Sunday on April 17 is in $($Diff.Days) days."
|
||||
} else {
|
||||
$Diff = $Now - $Easter
|
||||
& "$PSScriptRoot/give-reply.ps1" "Easter Sunday on April 17 was $($Diff.Days) days ago."
|
||||
& "$PSScriptRoot/speak-english.ps1" "Easter Sunday on April 17 was $($Diff.Days) days ago."
|
||||
}
|
||||
exit 0 # success
|
||||
} catch {
|
||||
|
@ -24,7 +24,7 @@ try {
|
||||
$Result = repair-volume -driveLetter $Drive -scan
|
||||
if ($Result -ne "NoErrorsFound") { throw "'repair-volume' failed" }
|
||||
|
||||
& "$PSScriptRoot/give-reply.ps1" "File system on drive $Drive is clean."
|
||||
& "$PSScriptRoot/speak-english.ps1" "File system on drive $Drive is clean."
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
@ -16,10 +16,10 @@ try {
|
||||
$IndependenceDay = [Datetime]("07/04/" + $Now.Year)
|
||||
if ($Now -lt $IndependenceDay) {
|
||||
$Diff = $IndependenceDay – $Now
|
||||
& "$PSScriptRoot/give-reply.ps1" "Independence Day on July 4th is in $($Diff.Days) days."
|
||||
& "$PSScriptRoot/speak-english.ps1" "Independence Day on July 4th is in $($Diff.Days) days."
|
||||
} else {
|
||||
$Diff = $Now - $IndependenceDay
|
||||
& "$PSScriptRoot/give-reply.ps1" "Independence Day on July 4th was $($Diff.Days) days ago."
|
||||
& "$PSScriptRoot/speak-english.ps1" "Independence Day on July 4th was $($Diff.Days) days ago."
|
||||
}
|
||||
exit 0 # success
|
||||
} catch {
|
||||
|
@ -14,7 +14,7 @@
|
||||
try {
|
||||
$ISS = (Invoke-WebRequest "http://api.open-notify.org/iss-now.json" -userAgent "curl" -useBasicParsing).Content | ConvertFrom-Json
|
||||
|
||||
& "$PSScriptRoot/give-reply.ps1" "The International Space Station is currently at $($ISS.iss_position.longitude)° longitude and $($ISS.iss_position.latitude)° latitude."
|
||||
& "$PSScriptRoot/speak-english.ps1" "The International Space Station is currently at $($ISS.iss_position.longitude)° longitude and $($ISS.iss_position.latitude)° latitude."
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
@ -33,7 +33,7 @@ try {
|
||||
$TimeSpan = TimeSpanToString($Midnight - $Now)
|
||||
$Reply = "Midnight is in $TimeSpan."
|
||||
}
|
||||
& "$PSScriptRoot/give-reply.ps1" "$Reply"
|
||||
& "$PSScriptRoot/speak-english.ps1" "$Reply"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
@ -15,7 +15,7 @@
|
||||
try {
|
||||
[system.threading.thread]::currentthread.currentculture=[system.globalization.cultureinfo]"en-US"
|
||||
$MonthName = (Get-Date -UFormat %B)
|
||||
& "$PSScriptRoot/give-reply.ps1" "It's $MonthName."
|
||||
& "$PSScriptRoot/speak-english.ps1" "It's $MonthName."
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
@ -35,7 +35,7 @@ try {
|
||||
} else { $Reply += ", last new moon was $MoonAge days ago"
|
||||
}
|
||||
|
||||
& "$PSScriptRoot/give-reply.ps1" "$Reply"
|
||||
& "$PSScriptRoot/speak-english.ps1" "$Reply"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
@ -16,9 +16,9 @@ try {
|
||||
$NewYear = [Datetime]("12/31/" + $Now.Year)
|
||||
$Days = ($NewYear – $Now).Days + 1
|
||||
if ($Days -gt 1) {
|
||||
& "$PSScriptRoot/give-reply.ps1" "New Year is in $Days days."
|
||||
& "$PSScriptRoot/speak-english.ps1" "New Year is in $Days days."
|
||||
} elseif ($Days -eq 1) {
|
||||
& "$PSScriptRoot/give-reply.ps1" "New Year is tomorrow."
|
||||
& "$PSScriptRoot/speak-english.ps1" "New Year is tomorrow."
|
||||
}
|
||||
exit 0 # success
|
||||
} catch {
|
||||
|
@ -32,7 +32,7 @@ try {
|
||||
$TimeSpan = TimeSpanToString($Now - $Noon)
|
||||
$Reply = "Noon was $TimeSpan ago."
|
||||
}
|
||||
& "$PSScriptRoot/give-reply.ps1" "$Reply"
|
||||
& "$PSScriptRoot/speak-english.ps1" "$Reply"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
@ -15,7 +15,7 @@ try {
|
||||
$Now = [DateTime]::Now
|
||||
$Diff = [Datetime]("12/06/" + $Now.Year) – $Now
|
||||
|
||||
& "$PSScriptRoot/give-reply.ps1" "Saint Nicholas Day is in $($Diff.Days) days."
|
||||
& "$PSScriptRoot/speak-english.ps1" "Saint Nicholas Day is in $($Diff.Days) days."
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
@ -31,7 +31,7 @@ try {
|
||||
$Area = $Weather.nearest_area.areaName.value
|
||||
$Region = $Weather.nearest_area.region.value
|
||||
|
||||
& "$PSScriptRoot/give-reply.ps1" "$($Temp)°C, $($Precip)mm rain, $($Humidity)% humidity, $($WindSpeed)km/h wind from $WindDir with $($Clouds)% clouds and $($Visib)km visibility at $Area ($Region)."
|
||||
& "$PSScriptRoot/speak-english.ps1" "$($Temp)°C, $($Precip)mm rain, $($Humidity)% humidity, $($WindSpeed)km/h wind from $WindDir with $($Clouds)% clouds and $($Visib)km visibility at $Area ($Region)."
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
@ -5,7 +5,6 @@
|
||||
This PowerShell script determines and speaks the current week number by text-to-speech (TTS).
|
||||
.EXAMPLE
|
||||
PS> ./check-week
|
||||
✔️ It's week #4.
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -13,8 +12,8 @@
|
||||
#>
|
||||
|
||||
try {
|
||||
$WeekNo = (get-date -UFormat %V)
|
||||
& "$PSScriptRoot/give-reply.ps1" "It's week #$WeekNo."
|
||||
$WeekNo = (Get-Date -UFormat %V)
|
||||
& "$PSScriptRoot/speak-english.ps1" "It's week #$WeekNo."
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
@ -22,7 +22,7 @@ try {
|
||||
$Area = $Weather.nearest_area.areaName.value
|
||||
$Region = $Weather.nearest_area.region.value
|
||||
|
||||
& "$PSScriptRoot/give-reply.ps1" "$($WindSpeed)km/h wind from $WindDir at $Area ($Region)."
|
||||
& "$PSScriptRoot/speak-english.ps1" "$($WindSpeed)km/h wind from $WindDir at $Area ($Region)."
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
@ -16,7 +16,7 @@ try {
|
||||
Clear-RecycleBin -Confirm:$false
|
||||
if ($lastExitCode -ne "0") { throw "'Clear-RecycleBin' failed" }
|
||||
|
||||
& "$PSScriptRoot/give-reply.ps1" "It's clean now."
|
||||
& "$PSScriptRoot/speak-english.ps1" "It's clean now."
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
@ -13,5 +13,5 @@
|
||||
|
||||
$Reply = "Merry Christmas to you too!", "Happy Christmas to you too!" | Get-Random
|
||||
|
||||
& "$PSScriptRoot/give-reply.ps1" "$Reply"
|
||||
& "$PSScriptRoot/speak-english.ps1" "$Reply"
|
||||
exit 0 # success
|
||||
|
@ -21,7 +21,7 @@ function TryToExec { param($Folder, $Binary)
|
||||
try {
|
||||
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."
|
||||
& "$PSScriptRoot/speak-english.ps1" "Sorry, can't find Git Extensions."
|
||||
exit 1
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
@ -23,6 +23,6 @@ try {
|
||||
TryToExec "C:\Programs\Microsoft Office\Office14" "OUTLOOK.EXE"
|
||||
throw "It seems Outlook isn't installed yet."
|
||||
} catch {
|
||||
& "$PSScriptRoot/give-reply.ps1" "Sorry: $($Error[0])"
|
||||
& "$PSScriptRoot/speak-english.ps1" "Sorry: $($Error[0])"
|
||||
exit 1
|
||||
}
|
||||
|
@ -22,5 +22,5 @@ try {
|
||||
TryToExec "C:\Program Files (x86)\Mozilla Thunderbird" "thunderbird.exe"
|
||||
throw "It seems Thunderbird isn't installed yet."
|
||||
} catch {
|
||||
& "$PSScriptRoot/give-reply.ps1" "Sorry: $($Error[0])"
|
||||
& "$PSScriptRoot/speak-english.ps1" "Sorry: $($Error[0])"
|
||||
}
|
||||
|
@ -14,5 +14,5 @@
|
||||
$Reply = "It's", "I get", "Now it's", "OK, I have" | Get-Random
|
||||
$Number = "1", "2", "3", "4", "5", "6" | Get-Random
|
||||
|
||||
& "$PSScriptRoot/give-reply.ps1" "$Reply $Number."
|
||||
& "$PSScriptRoot/speak-english.ps1" "$Reply $Number."
|
||||
exit 0 # success
|
||||
|
Loading…
Reference in New Issue
Block a user