我使用下面的AppleScript建立一個.dmg文件夾的設置,圖標間距,等等:爲什麼我的Applescript會將背景圖像添加到.dmg文件夾中,導致大小錯誤?
on run argv
tell application "Finder"
set diskname to item 1 of argv
tell disk diskname
open
set current view of container window to icon view
set toolbar visible of container window to false
set statusbar visible of container window to false
set bounds of container window to {400, 100, 900, 699}
set theViewOptions to the icon view options of container window
set arrangement of theViewOptions to not arranged
set icon size of theViewOptions to 100
set background picture of theViewOptions to file "background.png"
set file_list to every file
repeat with i in file_list
if the name of i is "Applications" then
set the position of i to {368, 135}
else if the name of i ends with ".app" then
set the position of i to {134, 135}
end if
-- Change the 7 to change the color: 0 is no label, then red,
-- orange, yellow, green, blue, purple, or gray.
set the label index of i to 7
end repeat
update without registering applications
delay 4
end tell
end tell
end run
窗口的設定正確,但有一個例外:在500x600 background.png圖像縮小到原尺寸的三分之一左右,並放置在左上角。我無法解釋爲什麼會發生這種情況。有什麼建議麼?
我試圖做同樣的想法使.dmg的背景,你能告訴我什麼是我需要的完整代碼? –