View Single Post
  #5  
Old May 13th, 2008, 11:13 AM
barhar barhar is offline
Registered User
 
Join Date: May 2005
Posts: 1,339
Thanks: 0
Thanked 1 Time in 1 Post
barhar is on a distinguished road
Enter the following into 'Script Editor', edit where appropriate, and save as a 'Script' ('.script') or application ('.app' - which is then called an AppleScript applet).

-- Code starts here --

set fName to "HD02_232.03_007:Users:barhar:Desktop:Untitled.fp7" -- Full path to 'FileMaker Pro' database file.

property firstNameCell : "First_Name" -- Name of 'First Name' assigned cell.
property eMailAddressCell : "eMail_Address" -- Name of 'e-mail Address' assigned cell.

property eM_Salutation : "Hello"
property eM_Subject : "Your subject here"
property eM_Contents : "Your e-Mail message content here"

tell application "FileMaker Pro Advanced 8.5"
activate

open file fName -- Open database file.
set {firstNames, eMailAddresses} to {(every cell of document 1 whose name is firstNameCell), (every cell of document 1 whose name is eMailAddressCell)}

-- quit -- Optional.
end tell

tell application "Mail"
activate

repeat with i from 1 to (count eMailAddresses)

set nMessage to make new outgoing message with properties {visible:false, subject:eM_Subject, content:(eM_Salutation & " " & (item i of firstNames) & "," & return & return & eM_Contents)}
tell nMessage
make new to recipient at end of to recipients with properties {address:(item i of eMailAddresses)}
send
end tell
end repeat

-- quit -- Optional.
end tell

-- Code ends here --

Also, to become familiar with AppleScript code - consider subscribing to Apples' AppleScript discussion group and / or its 'AppleScript-users' list serve. Other Apple developer list serves.
Reply With Quote