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

标签 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

窗口设置正确,但有一个异常(exception):500x600 background.png 图像缩小到原始大小的大约三分之一并放置在左上角。我无法解释为什么会发生这种情况。有什么建议?

最佳答案

男孩,这真的是 st00pid。

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

我用声明的 72 DPI 分辨率重新保存了图像,它运行良好。

关于macos - 为什么我的 Applescript 将背景图像添加到 .dmg 文件夹会导致大小错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8068959/

相关文章:

macos - graphviz 有没有好的 IDE 或 WYSIWYG 编辑器?

macos - 使用 Applescript 将命令和字符串发送到 Terminal.app

xcode - 使用 applescript 安装 ffmpeg

macos - 在applescript中,如何访问菜单项的键盘快捷键?

macos - 如何在ASyncSocket中检测远程断开连接

macos - keystore 密码?啊?

尝试使用 fix() 时,Mac OS X 10.13 上的 RStudio 获取 X11 不可用错误

c - 在 Xcode 中构建旧的 unix C 项目时指针给出错误?

file - 使用 AppleScript 立即删除文件

macos - "Can’ t 将\"0.0\"转换为类型号。 "number -1700 from "0.0"到数字