Skip to content

Add command links to the Read-Variable dialog #1049

@michaellwest

Description

@michaellwest

I would like the ability to run commands from the dialog produced by Read-Variable.

snag-0481

# Be sure to update this ID to whichever script you want to execute when the link is clicked.
$scriptId = "{6EAF681D-5D87-4C43-B279-356A8B9A15CF}"
$item = Get-Item -Path "."
$script = Get-Item -Path "master:" -ID $scriptId
$command = "item:executescript(id=$($item.ID),db=$($item.Database.Name),script=$($script.ID),scriptDb=$($script.Database.Name))"

$options = [ordered]@{"Download Sample"=$command;"View Documentation"=$command;}

$props = @{
    Parameters = @(
        @{Name="buttons"; Title="Super Userful Links"; Value = "Something interesting going on here."; Options=$options; Editor="link"; }
    )
    Title = "Command Dialog Demo"
    Icon = "OfficeWhite/32x32/fire.png"
    Description = "Provides an example of how to add links to the dialog."
    Width = 450
    Height = 300
    ShowHints = $true
}
Read-Variable @props

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions