mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-04-21 17:38:19 +02:00
Update export-to-serenade.ps1
This commit is contained in:
parent
af8f300a40
commit
cf4c1c6ffa
@ -1,6 +1,6 @@
|
|||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Exports all scripts to Serenade for voice control
|
Exports all scripts to Serenade
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
This script exports all PowerShell scripts to Serenade to execute them by voice.
|
This script exports all PowerShell scripts to Serenade to execute them by voice.
|
||||||
.PARAMETER WakeWord
|
.PARAMETER WakeWord
|
||||||
@ -13,8 +13,9 @@
|
|||||||
Specifies the target file ("$HOME\.serenade\scripts\PowerShell.js" by default)
|
Specifies the target file ("$HOME\.serenade\scripts\PowerShell.js" by default)
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./export-to-serenade.ps1 Computer
|
PS> ./export-to-serenade.ps1 Computer
|
||||||
⏳ Exporting 496 PowerShell scripts to C:\Users\Markus\.serenade\scripts\PowerShell.js...
|
⏳ Found 499 PowerShell scripts...
|
||||||
✔️ exported 496 scripts with wake word "Computer" to Serenade in 3 sec
|
⏳ Writing to C:\Users\Markus\.serenade\scripts\PowerShell.js using wake word "Computer"...
|
||||||
|
✔️ export to Serenade finished in 3 sec
|
||||||
.NOTES
|
.NOTES
|
||||||
Author: Markus Fleschutz · License: CC0
|
Author: Markus Fleschutz · License: CC0
|
||||||
.LINK
|
.LINK
|
||||||
@ -29,7 +30,8 @@ try {
|
|||||||
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||||
|
|
||||||
$Scripts = Get-ChildItem "$FilePattern"
|
$Scripts = Get-ChildItem "$FilePattern"
|
||||||
"⏳ Found $($Scripts.Count) scripts, exporting them to $TargetFile..."
|
"⏳ Found $($Scripts.Count) PowerShell scripts..."
|
||||||
|
"⏳ Writing $TargetFile using wake word `"$WakeWord`"..."
|
||||||
|
|
||||||
"/* NOTE: This file has been generated automatically by export-to-serenade.ps1 */" | Set-Content "$TargetFile"
|
"/* NOTE: This file has been generated automatically by export-to-serenade.ps1 */" | Set-Content "$TargetFile"
|
||||||
foreach ($Script in $Scripts) {
|
foreach ($Script in $Scripts) {
|
||||||
@ -39,7 +41,7 @@ try {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
||||||
"✔️ exported $($Scripts.Count) PowerShell scripts with wake word `"$WakeWord`" to Serenade in $Elapsed sec"
|
"✔️ export to Serenade finished in $Elapsed sec"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
Loading…
Reference in New Issue
Block a user