Create email with URL as Folder Action

Hello folks,

I’m a newbie to scripting and would be very grateful for any guidance in developing the following script. I would like a script which I could attach to a folder as an action, which would do the following:

  1. When a file is copied into a particular folder, the action immediately copies the name of the file to the clipboard

  2. An new email is created (using Mail) with a standard message. At the bottom of the message is a URL. The script then pastes the name of the file at the end of the URL.

I make PDF proofs for customers all day, every day. I would love to simply copy the PDF to the FTP folder on my Mac OS X Server and have the folder action automatically create the email with the link to the file, with the username and password in the URL. For example:

ftp://username:password@ftpaddress/Filename

Any help would be very appreciated!

Thanks,

-RobRoy

Model: Apple Powermac G4 17"
AppleScript: 1.10.6
Browser: Safari 417.9.3
Operating System: Mac OS X (10.4)

Hi electronaut.

This might be a starting point:


on adding folder items to thisFolder after receiving droppedFiles
	
	repeat with aFile in droppedFiles
		
		tell application "Finder"
			set proofName to (name of (aFile as alias) & "proof")
			set the clipboard to proofName--I originally left this line out because it isn't necessary for putting the name in the link, but put it back in case you have another reason for it.
		end tell
		
		tell application "Mail"
			activate
			
			set pdfLink to "ftp://username:password@ftpaddress/" & proofName
			set standardMessage to "Standard Message"
			set newMessage to make new outgoing message with properties {subject:proofName, content:standardMessage & return & return & pdfLink}
			tell newMessage
				set visible to true
			end tell
		
end tell
		
	end repeat
end adding folder items to

The new message is visible to show what it looks like. Once the script is finished, that might be unnecessary, provided the link and address can be automated.

Hope that helps

j