Mac bash 调用系统对话框
2017-04-23 11:49
162 查看
Show error message:
#!/usr/bin/env bash
# error "Message"
function error() {
osascript <<EOT
tell app "System Events"
display dialog "$1" buttons {"OK"} default button 1 with icon caution with title "$(basename $0)"
return -- Suppress result
end tell
EOT
}
error "Not enough cheese!"
(You can use
of
Ask question:
#!/usr/bin/env bash
# error "Message"
function error() {
osascript <<EOT
tell app "System Events"
display dialog "$1" buttons {"OK"} default button 1 with icon caution with title "$(basename $0)"
return -- Suppress result
end tell
EOT
}
error "Not enough cheese!"
(You can use
noteor
stopinstead
of
cautionto show a different icon.)
Ask question:
#!/usr/bin/env bash # prompt "Question" "Default value" function prompt() { osascript <<EOT tell app "System Events" text returned of (display dialog "$1" default answer "$2" buttons {"OK"} default button 1 with title "$(basename $0)") end tell EOT } value="$(prompt 'Enter:' '42')"
相关文章推荐
- 调用系统对话框复制文件
- XP系统中调用系统关机对话框
- C# 调用 系统的 日期和时间 属性对话框
- [转]如何锁定windows系统以及调用其它系统对话框
- 如何锁定windows系统以及调用其它系统对话框
- 在VC中直接调用系统对话框
- 如何锁定windows系统以及调用其它系统对话框
- C#调用系统Dll,弹出提示对话框
- 【转】如何锁定windows系统以及调用其它系统对话框
- 转载《WEB调用系统颜色选择对话框》
- 如何锁定windows系统以及调用其它系统对话框
- 如何锁定windows系统以及调用其它系统对话框
- C#调用系统的复制、移动、删除文件对话框
- 通过rundll32调用系统对话框
- 快速调用系统对话框(全)
- WEB调用系统颜色选择对话框
- VB==快速调用系统对话框(全)
- WEB调用系统颜色选择对话框
- 调用系统的数据链接属性对话框
- 通过rundll32调用系统对话框