Help us understand the problem. What is going on with this article?

sipsで画像ファイルの簡易チェックを行うAppleScript

More than 1 year has passed since last update.

画像ファイル専用の簡易データチェッカーです。

Finderで選択しているファイル・フォルダをSIPSにかけて、次のように出力します。bit数、プロファイル違いなどを見つけるのに使います。

ファイル数:16
16 space: CMYK
16 profile: Japan Color 2011 Coated
16 format: psd
16 bitsPerSample: 8

コードは以下。

use AppleScript version "2.4"
use scripting additions
use framework "Foundation"

tell application "Finder"
    set {myFiles, myResList, myResultText, myResult, myDelim} to {{}, {}, "", "", "\" \""}
    set mySel to selection

    repeat with i in mySel
        set myPath to POSIX path of (i as alias)
        if (class of i) is folder then
            set myResList to myResList & digFolder(myPath) of me
        else
            set myResList to myResList & myPath
        end if
    end repeat

    set myResultText to "\"" & retStrFromArrayWithDelimiter(myResList, myDelim) of me & "\""
    set myResult to "ファイル数:" & (count of myResList) & return & (do shell script "sips -g format -g space -g profile -g bitsPerSample " & myResultText & " | sed -e 's:^/.*$::g' -e '/^$/d' | sort -br | uniq -c | sed -e 's:^ *::g' ")
    log myResult -- 単体で使うにはdisplay alertなどにする
end tell


(* ここからサブ *)

on digFolder(myPath)
    set digItem to do shell script "find " & quoted form of myPath & " -type f ! -name '.*' | sed -e 's://:/:g'"
    return every paragraph of digItem
end digFolder

-- 以下ぴよまるより

on retStrFromArrayWithDelimiter(aList, aDelim)
    set anArray to current application's NSArray's arrayWithArray:aList
    set aRes to anArray's componentsJoinedByString:aDelim
    return aRes as text
end retStrFromArrayWithDelimiter

参考:http://piyocast.com/as/archives/669

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした