Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Read-Variable Sample
$item = get-item master:\content\Demo\Int\Presentation\Designs
$parent = get-item . |% { $_.Parent }
$result = Read-Variable -Parameters `
@{ Name = "from"; Value=[System.DateTime]::Now.AddDays(-5); Title="Start Date"; Tooltip="Date since when you want the report to run"; ShowTime=$true}, `
@{ Name = "item"; Title="Start Item"; Root="/sitecore/content/"; Tooltip="Branch you want to analyse."}, `
@{ Variable = get-variable "parent" }, `
@{ Name = "silent"; Value=$true; Title="Proceed Silently"; Tooltip="Check this is you don't want to be interrupted"; }, `
@{ Name = "someText"; Value="Some Text"; Title="Text"; Tooltip="Tooltip for singleline"; }, `
@{ Name = "someMultilineText"; Value="Multiline Text"; Title="Text"; lines=3; Tooltip="Tooltip for multiline"; }, `
@{ Name = "anOption"; Value="2"; Title="An Option"; Options="One|1|Two|2|Three|3"; Tooltip="Tooltip for dropdown"; }, `
@{ Name = "number"; Value=110; Title="I need this number too"; Tooltip="Tooltip for number"; }, `
@{ Name = "fraction"; Value=1.1; Title="I just a bit over 1 of this"; Tooltip="Tooltip for float"; } `
-Description "This report will analyse the branch and will tell you which of the pages have been changed since your selected date" `
-Title "Starting Parameters" -Width 500 -Height 680 `
-OkButtonName "Proceed" -CancelButtonName "Abort"
if($result -ne "ok")
{
Exit
}
"Variables from dialog:"
$from
$item.Paths.Path
$parent.Paths.Path
$silent
$someText
$someMultilineText
$anOption
$number
$fraction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment