画像の縦長横長を見てフォルダ仕分け

1つのフォルダに入っている画像を、画像サイズを取得して縦長か横長かを判定して、それぞれのフォルダに仕分けします。

スクリプト名:画像の縦長横長を見てフォルダ仕分け
set a to choose folder with prompt画像フォルダを選択
tell applicationFinder
  set allF to every file in a
end tell

set b to choose folder with prompt出力先フォルダ(縦)を選択
set c to choose folder with prompt出力先フォルダ(横)を選択

tell applicationImage Eventsto launch
repeat with i in allF
  set j to i as alias
  
set bb to retDirectionOfImage(j) of me
  
if bb = false then
    tell applicationFinder
      move i to b
    end tell
  else
    tell applicationFinder
      move i to c
    end tell
    
  end if
end repeat

on retDirectionOfImage(aFile)
  tell applicationImage Events
    activate
    
set this_image to open aFile
    
set {aWidth, aHeight} to dimensions of this_image
    
close aFile
  end tell
  
if aHeight > aWidth then
    return false
  else
    return true
  end if
end retDirectionOfImage

▼新規書類に ▼カーソル位置に ▼ドキュメント末尾に

Leave a Reply