-
Notifications
You must be signed in to change notification settings - Fork 1
/
Show-GuiInputBox.ps1
52 lines (39 loc) · 1.14 KB
/
Show-GuiInputBox.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
function Show-GuiInputBox {
<#
.SYNOPSIS
Text input dialog window
.DESCRIPTION
Displays a popup window with which a non-technical user can enter a string value for an automated routine
.PARAMETER Title
A title for the pop up window
.PARAMETER Message
Message or description shown before the text input field
.PARAMETER DefaultText
The initial value of the user text input field
#>
param (
# A title for the pop up window
[Parameter(Position=0)]
[string]
$Title = "Enter Text",
# Message or Description for list of items
[Parameter(Position=1)]
[string]
$Message = "Please enter a value here:",
# The initial value of the user text input field
[Parameter()]
[string]
$DefaultText
)
Begin {
Try {
Add-Type -AssemblyName Microsoft.VisualBasic -ea Stop
} Catch {
throw 'Unable to load VB assembly.'
}
}
Process {}
End {
[Microsoft.VisualBasic.Interaction]::InputBox($Message, $Title, $DefaultText)
}
}