Functions/LoupeDeck/Stop-LoupeDeck.ps1
function Stop-LoupeDeck { <# .Synopsis Stops Loupedeck .Description Stops the LoupeDeck application. .Example Stop-LoupeDeck .EXAMPLE Restart-LoupeDeck .Link Start-LoupeDeck #> param( # The Path to LoupeDeck. # If this parameter is not provided, this will attempt to launch Loupedeck from the default installation folder. [Parameter(ValueFromPipelineByPropertyName)] [string] $LoupeDeckPath, # If set, will output the created process. [switch] $PassThru ) process { if (-not $loupeDeckPath) { $loupeDeckProcess = Get-Process Loupedeck* -ErrorAction SilentlyContinue | Select-Object -First 1 $loupeDeckPath = if ($loupeDeckProcess) { $loupeDeckProcess.Path } elseif ((-not $PSVersionTable.Platform) -or ($PSVersionTable.Platform -match 'Win')) { "${env:ProgramFiles(x86)}\Loupedeck\Loupedeck2\Loupedeck2.exe" } elseif ($PSVersionTable.Platform -eq 'Unix' -and $PSVersionTable.OS -like '*darwin*') { "/Applications/Loupedeck.app/Contents/Resources/LoupedeckServiceTool.app" } } if (-not $loupeDeckPath) { Write-Error "Could not automatically detect a -LoupeDeckPath." return } else { $serviceToolPath = $loupeDeckPath | Split-Path | Join-Path -ChildPath $( if ($IsMacOS) { "LoupedeckServiceTool.app" } else { "LoupedeckServiceTool.exe" } ) $serviceToolArgs = @( if ($IsMacOS) { "--args" } "stop" ) & $serviceToolPath @serviceToolArgs } } } |