I know how to make a VBS msgBox on windows
message = ("HELLO",0,"Title")
But I want to do this on Mac with Powershell
Thank you for you answers :D
I know how to make a VBS msgBox on windows
message = ("HELLO",0,"Title")
But I want to do this on Mac with Powershell
Thank you for you answers :D
On macOS, you can call AppleScript's display alert
statement, via the osascript
CLI.
A simple example, with just an "OK" button:
$null = 'display alert "a title" message "a message"' | osascript
A more complex example with "OK" and "Cancel" buttons and storing the name of the button clicked in a variable:
$btnPressed = (('display alert "a title" message "a message" buttons ¬
{ "OK", "Cancel" }' | osascript -s s) -split '"')[1]
You can even add a variable...
$Text = "Test this variable"
$null = "display alert "$Text
"" | osascript