Advertisement
applehelpwriter

import images to Photos.app (10.10.3)

Apr 15th, 2015
2,026
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. set importFolder to choose folder
  2.  
  3. set extensionsList to {"jpg", "png", "tiff"}
  4. tell application "Finder" to set theFiles to every file of importFolder whose name extension is in extensionsList
  5.  
  6. if (count of theFiles) < 1 then
  7.     display dialog "No images selected!" buttons "OK"
  8. else
  9.     display dialog "Create a new album with name" default answer "Imports"
  10.     set albumName to text returned of the result
  11.     set timeNow to time string of (current date)
  12.     set today to date string of (current date)
  13.     set albumName to albumName & " " & timeNow & " " & today
  14.     set imageList to {}
  15.     repeat with i from 1 to number of items in theFiles
  16.         set this_item to item i of theFiles as alias
  17.         set the end of imageList to this_item
  18.     end repeat
  19.    
  20.     tell application "Photos"
  21.         activate
  22.         delay 2
  23.         import imageList into (make new album named albumName) skip check duplicates yes
  24.     end tell
  25. end if
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement