Automated Flickr Upload - Applescript

Discussion in 'Mac Programming' started by Catterpillar, Apr 20, 2007.

  1. Catterpillar macrumors newbie

    Joined:
    Apr 20, 2007
    #1
    Hi everyone!

    I made a script that allows me to send pictures to my flickr account by email, and it doesn't work very well. I"m new to all this, so I think I'll need a little help here :) The iPhoto import thing doesn't work, and I'm having issues with mail.app...

    Thanks in advance!!

    Here's the script:

    property globTag : "globimg"
    property AlbumFolder : "Macintosh HD:Users:steveboisvert:projets:Albums Photo:"
    property ScaleFolder : "Macintosh HD:Users:steveboisvert:projets:GLöB:Flickr Transferts:GLöB:FlickrScale:"
    property ToSend : "Macintosh HD:Users:steveboisvert:projets:GLöB:Flickr Transferts:GLöB:ToSend:"
    property theSender : "administration@glob-qc.ca"
    property recipCommon : "Photos"
    property recipAddress : "chump96just@photos.flickr.com"
    property FlickrTags : "Glob Québec"

    on adding folder items to this_folder after receiving these_items

    tell application "Finder"

    -- COPY IMAGES FOR SCALING--
    duplicate these_items to ScaleFolder
    set FlickrPictures to contents of ScaleFolder
    tell application "Macintosh HD:Users:steveboisvert:Library:Workflows:Applications:Folder Actions:FlickScale.app"
    open FlickrPictures
    end tell

    -- NEW ALBUM FOLDER FOR ARCHIVES --
    display dialog "Nom de l'album" default answer ""
    set albumName to text returned of result
    make new folder at AlbumFolder with properties {name:albumName}

    -- CREATE TAGS FOR ARCHIVES --
    repeat with this_item in these_items
    set item_name to (get displayed name of this_item)
    display dialog "Nom des gens sur la photo \"" & item_name & "\":" default answer ""
    set PictureIDs to text returned of result
    if item_name is not ".DS_Store" then
    set comment of this_item to (globTag & " " & PictureIDs) as string
    end if
    end repeat
    end tell
    -- IMPORT IMAGES TO iPHOTO --

    tell the application "iPhoto"
    activate
    import these_items
    end tell

    -- move these_items to (AlbumFolder & albumName)

    -- SEND IMAGES TO FLICKR --

    tell the application "Finder" to move files of folder ScaleFolder to ToSend
    set PicturesToSend to contents of ToSend
    set theSubject to albumName
    repeat with eachitem in PicturesToSend
    tell application "Mail"
    set newmessage to make new outgoing message with properties {content:"tags: " & albumName & " " & FlickrTags & return}
    tell newmessage
    set sender to theSender
    set subject to theSubject
    make new to recipient with properties {name:recipCommon, address:recipAddress}
    make new attachment with properties {file name:eachitem} at after the last paragraph
    end tell
    send newmessage
    end tell
    end repeat

    end adding folder items to
     
  2. kainjow Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #2
    It might help to post specific error messages you are getting, line numbers where errors are occurring, etc.
     

Share This Page