Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lanius412/ps-dialog
MessageBox, InputBox, FileDialog for Go
https://github.com/lanius412/ps-dialog
dialog golang powershell windows
Last synced: 14 days ago
JSON representation
MessageBox, InputBox, FileDialog for Go
- Host: GitHub
- URL: https://github.com/lanius412/ps-dialog
- Owner: lanius412
- Created: 2022-05-28T07:07:27.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-05-29T05:02:16.000Z (over 2 years ago)
- Last Synced: 2024-11-24T04:11:58.311Z (3 months ago)
- Topics: dialog, golang, powershell, windows
- Language: Go
- Homepage:
- Size: 10.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ps-dialog
Windows Dialog using powershell for Go
Details :# Features
* Message Box
|- Button Type - https://docs.microsoft.com/ja-jp/dotnet/api/system.windows.forms.messageboxbuttons?view=windowsdesktop-6.0
|_ Icon Type - https://docs.microsoft.com/ja-jp/dotnet/api/system.windows.forms.messageboxicon?view=windowsdesktop-6.0
* Input Box
* File Dialog (Open and Save)# Usage
```
import dialog "github.com/lanius412/ps-dialog"func main() {
/* Message Box */
msgBox := dialog.Message("Do you want to try again?").Title("Message")
result, err := msgBox.Button(dialog.Btn_AbortRetryIgnore).Icon(dialog.Icon_Exclamation).Show()
if err != nil {
panic(err)
}
fmt.Println(result) // Abort, Retry or Ignore
/* Input Box */
psword, _ := dialog.InputBox().Title("Input").Description("Type password").Show()
fmt.Println(psword)
/* File Dialog */
fileDlg := dialog.File().Title("File")
filepaths, result, _ := fileDlg.SetStartDir("C:\\").SetFileter("text file(*.txt)", "txt").Multiple().Open()
if result != "Cancel" {
fmt.Println(filepaths) // [C:\Users\[username]\Downloads\sample1.txt, C:\Users\dev_win\Downloads\sample2.txt]
}
}
```