在AppleScript中自定义窗口对话框的外观?

时间:2013-11-25 08:02:07

标签: applescript

我想知道是否可以在Applescript中更改对话窗口的外观,例如更改自定义图片或图标的图标(注意,停止,警告)。

如果可以更改排版(对齐,字体,粗体......等)

如果是的话,你能帮我一个代码示例,或者提供一个好的教程链接!

set folderName to text returned of (display dialog "Please enter new folder name:" default answer "Folder_Name")
set loc to choose folder "Choose Parent Folder Location"

try
    tell application "Finder"
        set newFolder to make new folder at loc with properties {name:folderName}       
    end tell

    display dialog "Successfully! Want to reveal the new folder?" with icon note buttons {"Cancel", "Go to my new folder"} default button "Go to my new folder" cancel button "Cancel"
    if button returned of the result = "Go to my new folder" then
        tell application "Finder"
            reveal newFolder
            activate
        end tell
    end if
end try

3 个答案:

答案 0 :(得分:2)

您无法更改排版。但是你可以使用:

display dialog "hi" with icon withIconFile

其中withIconFile是'.icns'文件的别名或文件引用

答案 1 :(得分:1)

这对我来说更好!

 display dialog "My custom icon " buttons {"Cancel", "Continue"} default button "Continue" with icon file "Path:to:my.icon.icns"

答案 2 :(得分:0)

你也可以这样做:

display dialog "Hello" buttons {"Cancel", "Continue"} with icon {"/Users/" & (do shell script "whoami") & "/path/to/picture.jpg"}

do shell script部分只是让它发挥作用,即使你把它发送给你的朋友,虽然我会建议用卷曲从互联网上下载图像并将其放在一个文件夹中。对不起,如果有点混乱