-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdemo.ps1
More file actions
35 lines (25 loc) · 1.07 KB
/
demo.ps1
File metadata and controls
35 lines (25 loc) · 1.07 KB
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
#requires -version 7.5
using module .\GUICommands.psd1
try
{
$GUIBridge = New-GUIBridge
$selectedFolder = Invoke-FolderPickerDialog -bridge $GUIBridge -title "Select a folder" -suggestedStartLocation $HOME
"selected folder: $selectedFolder"
$imageFileFilters = @(
@{ Name = 'Images'; Extensions = @('*.jpg', '*.jpeg', '*.bmp') },
@{ Name = 'All Files'; Extensions = @('*.*') }
)
$imageFiles = Invoke-OpenFileDialog -bridge $GUIBridge -title "Open image file" -suggestedStartLocation $HOME -allowMultiple $true -filters $imageFileFilters
"selected image files: $imageFiles"
$textFileFilters = @(
@{ Name = 'Text Files'; Extensions = @('*.txt', '*.md') },
@{ Name = 'All Files'; Extensions = @('*.*') }
)
$textFile = Invoke-SaveFileDialog -bridge $GUIBridge -title "Save text file" -suggestedStartLocation $HOME -SuggestedFileName "howdiedo.txt" -showOverwritePrompt $true -filters $textFileFilters
"save text file as: $textFile"
}
finally
{
Close-GUIBridge -bridge $GUIBridge
"closed GUIBridge."
}