From dcb11e4c6e79fa7b2bce3ce62a26f6ac4798ea10 Mon Sep 17 00:00:00 2001 From: Markus Fleschutz Date: Sun, 24 Oct 2021 20:13:47 +0200 Subject: [PATCH] Update export-to-serenade.ps1 --- Scripts/export-to-serenade.ps1 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Scripts/export-to-serenade.ps1 b/Scripts/export-to-serenade.ps1 index 9e4a1e9b..2b831227 100755 --- a/Scripts/export-to-serenade.ps1 +++ b/Scripts/export-to-serenade.ps1 @@ -7,6 +7,8 @@ Specifies the wakeword (none by default) .PARAMETER FilePattern Specifies the file pattern for the scripts ("$PSScriptRoot/*.ps1" by default) +.PARAMETER Application + Specifies the application to be used .PARAMETER TargetFile Specifies the target file ("$HOME/.serenade/scripts/PowerShell.js" by default) .EXAMPLE @@ -21,7 +23,7 @@ #requires -version 2 -param([string]$WakeWord = "", [string]$FilePattern = "$PSScriptRoot/*.ps1", [string]$TargetFile = "$HOME/.serenade/scripts/PowerShell.js") +param([string]$WakeWord = "", [string]$FilePattern = "$PSScriptRoot/*.ps1", [string]$Application = "terminal", [string]$TargetFile = "$HOME/.serenade/scripts/PowerShell.js") try { $StopWatch = [system.diagnostics.stopwatch]::startNew() @@ -33,7 +35,7 @@ try { foreach ($Script in $Scripts) { $ScriptName = $Script.basename $Keyword = $ScriptName -replace "-"," " - "serenade.global().command(`"$WakeWord $Keyword`", async (api) => { await api.focusOrLaunchApplication(`"terminal`"); await api.typeText(`"$ScriptName.ps1`"); await api.pressKey(`"return`"); });" | Add-Content "$TargetFile" + "serenade.global().command(`"$($WakeWord.toLower()) $Keyword`", async (api) => { await api.focusOrLaunchApplication(`"$Application`"); await api.typeText(`"$ScriptName.ps1`"); await api.pressKey(`"return`"); });" | Add-Content "$TargetFile" } [int]$Elapsed = $StopWatch.Elapsed.TotalSeconds