Photography Workflow Automation

Hello! I am a professional photographer and I have been searching for a way to automate some of my workflow when importing photos. I found this site and have looked through the posts and have found some awesome scripts(you guys are geniuses), but nothing that fits my needs exactly. I was hoping you could help me out. Here’s what I would like automated:

When I import my photos I use Image Capture to place the selected photos into a folder on my Desktop called “Need to Edit” and named after the client - example: Davis, Christy. Next I import those photos into Adobe Lightroom and make my edits. I then export the images into a folder on the Desktop using the clients last name followed by Jpegs - example: Davis Jpegs.

Now the part I would like automated is this, I would like to be able to drag that folder onto an applet or however it works and have the following done in order:

  1. Move a copy of the files (Davis Jpegs) to a folder on my Desktop called “Upload to FTP”
  2. Resize the files(Davis Jpegs) to under 1200x1200 at 150 dpi and place them in a folder on the Desktop called “Davis Proofs”
  3. Then, copy the files(Davis Proofs) to a folder on my Desktop called “Upload to Site”
  4. Then, using Transmit, upload the files(Davis Proofs) from the folder “Upload to Site” to a folder on my server(ftp.jdmabry.com) in the following directory: /Darren/ToBePrinted/
  5. After the files have uploaded, I would like to tell Transmit to upload the files(Davis Jpegs) to the same ftp server but in the directory: Darren/Clients/
  6. Once the files(Davis Jpegs) are done uploading, I would like the files deleted from the folder “Upload to FTP” that resides on my Desktop.
  7. And finally, I would like to move the original client files(Davis, Christy) to an external drive called “Photo Backup 3” that is attached to my computer, into a pre-existing directory called “Clients”.

Thanks in advance to anyone willing to give this a try. If this can be done, it will make my life a whole lot easier.

Model: Power Mac Dual 2ghz
Browser: Safari 522.12
Operating System: Mac OS X (10.4)

Hi,

welcome to MacScripter.

AppleScript is a perfekt tool to automate these things you described.
Give the following a try, you must only replace user and ¢¢¢¢ with your server username and password
and save the script as an application.

Transmit in not needed, the CLI curl is used.
If you doubleclick the script, you can choose the client (Davis, Christy) or drop the folder on the icon of the app.

The script has a rather poor error handling, so all folders on the server and on your desktop must exist.

One problem could be the built-in application Image Events. It’s not very fast and it can scale images only by pixels but regardless of the number of dpi.
There are a few CLI solutions like ImageMagick which can do this much better.
At the end there is a little report about the errors.

property ftpserverPath : "[url=ftp://ftp.jdmabry.com/Darren/]ftp.jdmabry.com/Darren/[/url]"
property Clients : "Clients/"
property ToBePrinted : "ToBePrinted/"
property user_name : "user"
property pass_word : "¢¢¢¢"

property maxSize : 1200
property BackupDisk : "Photo Backup 3"


on run
	set b to ((button returned of (display dialog "Choose a client" buttons {"Cancel", "Davis", "Christy"}) is "Christy") as integer) + 1
	process(b)
end run

on open theFolder
	try
		set {name:Nm, folder:Fo} to info for theFolder
		if Fo and (get first word of Nm) is in {"Davis", "Christy"} then
			set b to ((Nm contains "Christy") as integer) + 1
			process(b)
		end if
	end try
end open

on process(folderIdx)
	set d to path to desktop as Unicode text
	set Jpegs to d & item folderIdx of {"Davis Jpegs:", "Christy Jpegs:"}
	set Proofs to d & item folderIdx of {"Davis Proofs:", "Christy Proofs:"}
	set UploadSite to d & "Upload to Site:"
	set UploadFTP to d & "Upload to FTP:"
	
	tell application "Finder"
		set theFiles to files of folder Jpegs
		set uploadFiles to duplicate theFiles to folder UploadFTP
	end tell
	
	set ProofList to {}
	set IEerror to 0
	set CURLerror to 0
	tell application "Image Events"
		launch
		repeat with oneFile in theFiles
			set Nm to name of (info for oneFile as alias)
			try
				set this_image to open oneFile as alias
				scale this_image to size maxSize
				set end of ProofList to (save this_image in file (Proofs & Nm) with icon) as alias
				close this_image
			on error e
				set IEerror to IEerror + 1
				try
					close image 1
				end try
			end try
		end repeat
		quit
	end tell
	
	tell application "Finder" to set ProofFiles to duplicate ProofList to folder UploadSite
	
	repeat with i from 1 to count theFiles
		curl_upload(POSIX path of (item i of ProofFiles as alias), ftpserverPath & ToBePrinted)
		curl_upload(POSIX path of (item i of theFiles as alias), ftpserverPath & Clients)
	end repeat
	
	tell application "Finder"
		delete uploadFiles
		if disk BackupDisk exists then move theFiles to folder "Clients" of disk BackupDisk
	end tell
	display dialog "Done" & return & return & IEerror & " Image Event error(s)" & return & CURLerror & " Curl error(s)" buttons {"OK"} default button 1
end process

on curl_upload(source, dest)
	try
		do shell script "curl " & quoted form of dest & " -u " & user_name & ":" & pass_word & " -T " & quoted form of source
		return true
	on error
		set CURLerror to CURLerror + 1
		return false
	end try
end curl_upload

StefanK,

Wow! Amazing! Thank you for taking the time to do that!

When I ran the application, it asked me for “Davis” or “Christy”. That name was just an example. Each time I run the application it will be a different client with a different name. Can the application pull the name from the file that I select or drop on it?

I have a couple more questions:

  1. The folders “Upload to Site & Upload to FTP” are always on my Desktop, however I was hoping to be able to automate the creation of the client folders(Davis Jpegs & Davis Proofs) as well. Is there a way to have Automator create these folders at the beginning by taking whatever is in front of the comma (Davis, Christy - so it would take Davis) and create the two folders. After creating the two folders, then it could run the script?

  2. You mentioned that the image editing part of the script is slow. Is it possible to have the script interact with Photoshop and either run the built in Photoshop script called “Image Processor” and enter in the appropriate values to resize, or could it tell Photoshop to run an action? If so, I could create an action that batch processes the photos.

Thanks for your time, I really appreciate you working on this. I wish I had your knowledge of scripting!

Of course, if the naming rules are always the same

Sure

Photoshop is very well scriptable, e.g you can call actions with AppleScript.
But if you don’t mind, that Image Events can’t consider the dpi parameter, try it first

So is the script already set up to do this? When I dragged a folder onto the application, it ran but didn’t process the files.

I think I might be able to do this part, I’ll let you know if I get it working.

I can create the action, getting the script to execute it in PhotoShop, however, I don’t know how to do.

As I’m sure you noticed, I have very little experience with scripting. So any help you give me is very much appreciated. I cant say thank you enough. I’m just glad that there are people out there like yourself, who are willing to help. That’s what I love about the Mac community!

sorry, I meant: of course it’s possible, but the script must be changed a bit.
Can you tell me, in which way the files or folders are named

something like this

set theImage to (choose file)
set Nm to name of (info for theImage)
tell application "Adobe Photoshop CS3"
	open file (theImage as Unicode text)
	do action "myFavoriteAction" from "myActions.atn"
	save current document in ((path to desktop as Unicode text) & Nm)
end tell

They are always named as follows: Last, First (Davis, Christy)

Can you tell me where to put this script to replace the original image editing part of the script?

Thanks,

JD

try this, I removed the run handler, so it just a droplet.
I’m not the Photoshop scripting specialist, I hope it works

property ftpserverPath : "[url=ftp://ftp.jdmabry.com/Darren/]ftp.jdmabry.com/Darren/[/url]"
property Clients : "Clients/"
property ToBePrinted : "ToBePrinted/"
property user_name : "user"
property pass_word : "¢¢¢¢"

property maxSize : 1200
property BackupDisk : "Photo Backup 3"


on open theFolder
	try
		set {name:Nm, folder:Fo} to info for theFolder
		if Fo then process(get first word of Nm)
	end try
end open

on process(theClient)
	set d to path to desktop as Unicode text
	set Jpegs to d & theClient & " Jpegs:"
	set Proofs to d & theClient & " Proofs:"
	set UploadSite to d & "Upload to Site:"
	set UploadFTP to d & "Upload to FTP:"
	
	tell application "Finder"
		set theFiles to files of folder Jpegs
		set uploadFiles to duplicate theFiles to folder UploadFTP
	end tell
	
	set ProofList to {}
	set IEerror to 0
	set CURLerror to 0
	tell application "Adobe Photoshop CS3"
		repeat with oneFile in theFiles
			set Nm to name of (info for oneFile as alias)
			try
				open file (oneFile as Unicode text)
				do action "myFavoriteAction" from "myActions.atn"
				set end of ProofList to file path of (save current document in (Proofs & Nm))
				close current document
			on error e
				set IEerror to IEerror + 1
				try
					close current document
				end try
			end try
		end repeat
		quit
	end tell
	
	tell application "Finder" to set ProofFiles to duplicate ProofList to folder UploadSite
	
	repeat with i from 1 to count theFiles
		curl_upload(POSIX path of (item i of ProofFiles as alias), ftpserverPath & ToBePrinted)
		curl_upload(POSIX path of (item i of theFiles as alias), ftpserverPath & Clients)
	end repeat
	
	tell application "Finder"
		delete uploadFiles
		if disk BackupDisk exists then move theFiles to folder "Clients" of disk BackupDisk
	end tell
	display dialog "Done" & return & return & IEerror & " Image Event error(s)" & return & CURLerror & " Curl error(s)" buttons {"OK"} default button 1
end process

on curl_upload(source, dest)
	try
		do shell script "curl " & quoted form of dest & " -u " & user_name & ":" & pass_word & " -T " & quoted form of source
		return true
	on error
		set CURLerror to CURLerror + 1
		return false
	end try
end curl_upload