【问题标题】:Folder listing with icons in Mac OS XMac OS X 中带有图标的文件夹列表
【发布时间】:2013-05-21 15:14:27
【问题描述】:

我想将我 Mac 上所有应用程序的精美列表发送给朋友,其中包含图标和简短的 cmets。我将 cmets 编写为 Finder cmets(在每个应用程序的“获取信息”窗口中)。我尝试使用一个名为“打印窗口”的有前途的应用程序,但它会截断我的 cmets。然后我试图找到一个 AppleScript 解决方案(在 TextEdit 中编译一个列表),但似乎没有简单的方法可以做到这一点——至少在不安装一些额外的东西的情况下(我不想这样做)。

如果我能得到一个可编辑的列表,在 TextEdit 中编辑它会很好:应用名称、应用图标、评论。

有人知道解决办法吗?

谢谢。

【问题讨论】:

    标签: macos icons applescript


    【解决方案1】:

    我会使用这样的 shell 脚本:

    mkdir -p icons
    i=1
    
    for a in /Applications/*.app; do
        name=${a%.app}
        name=${name##*/}
        comments=$(osascript -e 'on run {a}
        tell app "Finder" to comment of (POSIX file a as alias)
        end' "$a")
        icon=$(defaults read "$a/Contents/Info.plist" CFBundleIconFile)
        [[ $icon != *.* ]] && icon="$icon.icns"
        sips "$a/Contents/Resources/$icon" -Z 128 -s format png -o icons/$i.png
        output+="<div style=\"clear:both;width:600px;margin:0 auto\">
    <div style=float:left><h2>$name</h2><div>$comments</div></div>
    <img style=float:right src=\"icons/$i.png\">
    </div>
    "
        let i++
    done
    
    echo "$output" > index.html
    open index.html
    

    Spotlight cmets 通常存储为扩展属性和 .DS_Store 文件。如果您使用 Finder 更改您没有写入权限的文件或文件夹的 cmets(如默认情况下的某些应用程序包),则 cmets 仅存储在 .DS_Store 文件中,因此无法使用 xattr 读取它们或 mdls。

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-03-11
    • 2011-07-18
    • 1970-01-01
    • 1970-01-01
    • 2013-04-18
    • 2015-03-29
    • 2015-09-13
    相关资源
    最近更新 更多