如何使在Mac终端弹出/警报? AppleScript的? [英] How do I make a Mac Terminal pop-up/alert? Applescript?
问题描述
我希望能有我的程序显示一个警告,通知,无论是显示我的自定义文本。如何做到这一点?此外,是否有可能使一个与几个按钮,可以设置一个变量?
I want to be able to have my program display an alert, notice, whatever that displays my custom text. How is this done? Also, is it possible to make one with several buttons that sets a variable?
类似批次的:回声的msgbox< a.vbs&安培; a.vbs
推荐答案
使用<一个href=\"https://web.archive.org/web/20141112143109/http://hintsforums.macworld.com/showthread.php?t=91912\"><$c$c>osascript$c$c>.例如:
osascript -e 'tell app "Finder" to display dialog "Hello World"'
与你想要的任何应用程序更换发现者。请注意,如果该应用程序正在后台运行,对话框将出现在背景中了。要始终显示在前台,用系统事件作为应用程序:
Replacing "Finder" with whatever app you desire. Note if that app is backgrounded, the dialog will appear in the background too. To always show in the foreground, use "System Events" as the app:
osascript -e 'tell app "System Events" to display dialog "Hello World"'
了解更多关于<一个href=\"https://web.archive.org/web/20141112143109/http://hintsforums.macworld.com/showthread.php?t=91912\">Mac OS X提示。
这篇关于如何使在Mac终端弹出/警报? AppleScript的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!