Skip to content

Instantly share code, notes, and snippets.

@AdamNaj
Last active December 20, 2015 21:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AdamNaj/6200176 to your computer and use it in GitHub Desktop.
Save AdamNaj/6200176 to your computer and use it in GitHub Desktop.
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