Photography Workflows – Filemaker and Applescript – 1

The idea behind these blogs is not to give you answers to all your workflow woes but to get you interested in building your own photography workflows for your photography business. I’ll call this process Brain Food. (Mac only BTW. PC owners miss out in so many ways).

We all work in different ways and your workflows will reflect that difference. Sure there is common ground and this first blog will reflect a basic issue.

As a professional photographer we all take pictures for clients so the first problem that has to be addressed is how do we relate our clients information with the clients images? We can’t put sensitive client info in the metadata inside the image because anyone can read that so a different solution has to be found. (If you have scripted before and know about databases this is not for you yet).

Lets have some Brain Food.

Your images need to be stored somewhere so lets make a folder to put them in. Create a folder in your Pictures folder and call it My Clients

alias “Your Laptop:Users:YOU:Pictures:My Clients” (thats a path to your folder BTW)

Open your Contacts App and create a fictitious client. Create a name, email and Twitter name (to add a Twitter account click + and scroll down to more fields. Twitter is at the bottom). Leave your newly created Contact open.

So we have a folder to store images and a database (Contacts) to store client information. Wouldn’t it be great if we could just click one button and the images would be renamed and filed away?

Well we can using Applescript. I don’t expect you to understand this but only to enlighten your curiosity. If we can assemble information we can then use it to do stuff.

Open up the app Script Editor

“Your Laptop:Applications:Utilities:Script Editor”

and copy and paste the code into the editor.

 

 

 

property num : 0

property p_ath : ((path to pictures folder from user domain) & “My Clients”) as string as alias

display dialog “Choose some images. It makes a copy so won’t screw your originals.”

set theFiles to choose file with multiple selections allowed

–get the info out of contacts

tell application “Contacts”

set thepeople to selection

set allInfo to properties of (item 1 of thepeople)

set theID to id of allInfo

set fname to first name of person id theID

set lname to last name of person id theID

set theclient to (fname & ” ” & lname)

set theEmails to properties of emails of person id theID

set theEmail to value of (item 1 of theEmails)

set socialpro to properties of social profiles of person id theID

set theTwit to user name of (item 1 of socialpro)

set theTwit to (“@” & theTwit as string)

end tell

–so now we have got this info we can use it

display dialog (“By magic I have extacted this info from the database” & return & theclient & return & theEmail & return & theTwit as string)

set firstchar to first character of theclient

FOLDERMAKER(p_ath, firstchar)

set pathtoFolder to (p_ath & firstchar & “:”) as string as alias

FOLDERMAKER(pathtoFolder, theclient)

set pathtoClient to (pathtoFolder & theclient & “:”) as string as alias

FOLDERMAKER(pathtoClient, “Original Files”)

FOLDERMAKER(pathtoClient, “Lo Res”)

set pathtoClientImages to (pathtoClient & “Original Files:” as string as alias)

tell application “Finder”

–try

duplicate theFiles to pathtoClientImages

–end try

end tell

display dialog “The script now going to rename the files” buttons {“OK”}

set theImages to createALIASlists(pathtoClientImages)

rename(theImages, theclient, num)

tell application “Contacts”

set note of person id theID to pathtoClient as string

save

end tell

tell application “Finder”

reveal pathtoClient

end tell

display dialog “Neat isn’t it. Check your client details in Contacts. You will see that a path has been created to your clients folder ”

on rename(theImages, theclient, num)

repeat with i from 1 to number of items in theImages

set this_item to item i of theImages

set num to num + 1

tell application “System Events” to set {fname, fExt} to {name, name extension} of this_item

–rename the image

tell application “Finder”

try

set name of this_item to (theclient & “_” & num & “.” & fExt as string)

end try

end tell

end repeat

end rename

on createALIASlists(pathtoFolder)

tell application “Finder”

try

set theList to (every file) of pathtoFolder as alias list

on error

set theList to (every file) of pathtoFolder as alias

end try

end tell

end createALIASlists

on FOLDERMAKER(p_ath, folderlist)

try

tell application “Finder”

make new folder at p_ath with properties {name:folderlist}

end tell

end try

end FOLDERMAKER

SE.jpg

Click the hammer icon to compile and then the arrow to run the script.

or download the file here

Sit down and think of the possibilities……

(Disclaimer: There is nothing in this script that will fry your Mac, but if does I aint responsible.)

 

 

 

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.