Private/Invoke-AppleScript.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Function Invoke-AppleScript {
    <#
        .SYNOPSIS
            Executes a command string via Apple Script.
    #>

    [cmdletbinding(SupportsShouldProcess)]
    param(
        [Parameter(Mandatory, ValueFromPipeline, Position = 0)]
        [String]
        $Command
    )
    Begin {
    }
    Process {
        If ($PSCmdlet.ShouldProcess('/usr/bin/osascript -e',$Command)){
            /usr/bin/osascript -e $Command
        }
    }
}