Apple脚本-如何在对话框中显示URL链接

时间:2019-05-15 07:18:03

标签: macos url hyperlink dialog applescript

我想知道是否有任何方法可以在Apple脚本对话框中显示URL链接,以便用户能够单击该链接并自动将其打开。

1 个答案:

答案 0 :(得分:0)

我已经找到了如下解决方案,

osascript <<'END'
    set theAlertText to "Swiftlint is not installed"
    set theAlertMessage to "Download from https://github.com/realm/SwiftLint manually. Would you like to open link?"
    display alert theAlertText message theAlertMessage as critical buttons {"Cancel", "Open link"} default button "Open link" cancel button "Cancel" giving up after 60
    set the button_pressed to the button returned of the result
    if the button_pressed is "Open link" then
        open location "https://github.com/realm/SwiftLint/blob/master/README.md"
    end if
END