为什么我的Applescript会将背景图像添加到.dmg文件夹中,从而导致大小错误?

jma*_*ard 4 macos applescript

我正在使用以下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
Run Code Online (Sandbox Code Playgroud)

窗口设置正确,但有一个例外:500x600 background.png图像缩小到原始大小的三分之一并放在左上角.我无法解释为什么会这样.有什么建议?

jma*_*ard 5

男孩,这真的是st00pid.

我在OS X Lion上遇到了这个问题.事实证明,Lion要求将文件夹的背景图像设置为72 DPI.我使用的图像是200 DPI,因此Lion将其从实际像素缩小.

我以声明的分辨率72 DPI重新保存了图像,并且它完美地工作.