我想知道是否可以更改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
您不能更改排版。但是您可以使用:
display dialog "hi" with icon withIconFile
其中withIconFile是对'.icns'文件的别名或文件引用
这对我来说更好!
display dialog "My custom icon " buttons {"Cancel", "Continue"} default button "Continue" with icon file "Path:to:my.icon.icns"
您还可以执行:
display dialog "Hello" buttons {"Cancel", "Continue"} with icon {"/Users/" & (do shell script "whoami") & "/path/to/picture.jpg"}
do shell script
部分只是让它发挥作用,即使你把它发给你的朋友,尽管我建议你用curl从互联网上下载图像,并把它放在文件夹里。如果有点混乱,很抱歉