Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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]
}
}
```