import images to (10.10.3)

applehelpwriter Apr 15th, 2015 1,081 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. set importFolder to choose folder
  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
  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
  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
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand