Почему мой Applescript добавляет фоновое изображение в папку .dmg, получая неправильный размер? - PullRequest
4 голосов
/ 09 ноября 2011

Я использую следующий 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.Изображение PNG сокращается до трети исходного размера и помещается в верхний левый угол.Я не могу объяснить, почему это происходит.Есть предложения?

1 Ответ

5 голосов
/ 10 ноября 2011

Мальчик, это действительно st00pid.

Я столкнулся с этой проблемой на OS X Lion.Оказывается, что Lion требует, чтобы фоновое изображение для папки было установлено на 72 DPI.Я использовал изображение с разрешением 200 DPI, поэтому Lion уменьшил его до фактических пикселей.

Я заново сохранил изображение с заявленным разрешением 72 DPI, и оно отлично работает.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...