LoginSignup
0
0

More than 5 years have passed since last update.

Bridgeで選択したファイルをsipsでJPEGにする

Last updated at Posted at 2014-07-08

最終

Bridgeの「app.system」でいけるんじゃん…w
@happyscript さんに教えてもらいましたありがとうございます。
別アプリ無しで、直にsipsに渡してます。

Bridge2JPEG(SIPS).scpt
tell application "Adobe Bridge CC"
    do javascript "var myList=app.document.selections;for(var i=0;i<myList.length;i++){app.system('exec sips -s format JPEG -s formatOptions 80 \"'+myList[i].path+'\" --out \"'+myList[i].parent.path+'\" &>/dev/null &');}"
end tell

あーらくちん

以下古いモノ

スクリプトメニューに登録

Bridge2JPEG.scpt
tell application "Adobe Bridge CC"
    do javascript "var myList = app.document.selections;for(var i=0; i<myList.length; i++){    myList[i].openWith('/Applications/2_JPEG.app');}"
end tell

tell application "2_JPEG"
    quit
end tell

アプリケーションフォルダに保存(自動的に終了させないアプリとして保存)

2_JPEG.app
on open myDrops
    tell application "Finder"
        set myDir to container of (myDrops as alias)
    end tell

    do shell script "sips -s format JPEG " & quoted form of (POSIX path of (myDrops as Unicode text)) & " --out " & quoted form of (POSIX path of (myDir as Unicode text)) & "&>/dev/null &"
end open

メモ的に。
#途中で止まってしまう…
ので書き直し。プロセス監視して5回sipsが無ければ終了するように。

実行後終了しないように保存

2_JPEG.app
property myFlag : 0
on open myDrops
    tell application "Finder"
        set myDir to container of (myDrops as alias)
    end tell

    do shell script "exec sips -s format JPEG -s formatOptions 80 " & quoted form of (POSIX path of (myDrops as Unicode text)) & " --out " & quoted form of (POSIX path of (myDir as Unicode text)) & " &>/dev/null &"
end open
on idle
    try
        do shell script "ps x | grep sips | grep -v grep"
    on error
        set myFlag to myFlag + 1
    end try
    if myFlag > 5 then quit me
    return 1

end idle
Bridge2JPEG.scpt
tell application "Adobe Bridge CC"
    do javascript "var myList = app.document.selections;for(var i=0; i<myList.length; i++){myList[i].openWith('/Applications/2_JPEG.app');}"
end tell
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0