View Single Post
  #12  
Old May 16th, 2008, 11:59 AM
hkinzler hkinzler is offline
Registered User
 
Join Date: May 2008
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
hkinzler is on a distinguished road
Question Here's what I have...

One of the first things I realized barhar was the difference in the code, and how I would have to change it to fit my file/misc. locations. The first name and e-mail fields are defined as "GEN.FNAME" and "GEN.EMAIL", respectively. They have been in the property line since you first coded it, however, now I don't know why its not finding those cells, or field values. Below is what I have:

property firstNameCell : "GEN.FNAME" -- Name of 'First Name' assigned cell.
property eMailAddressCell : "GEN.EMAIL" -- Name of 'e-mail Address' assigned cell.

property eM_Salutation : "Dear"
property eM_Subject : "Updating Contact Database"
property eM_Contents : "Message...I took it away for text purposes..."

tell application "FileMaker Pro"
activate
getURL "fmp7://[username]:[password]@192.168.0.103/Applicants"
tell table "Applicants"
show (every record whose cell "GEN.LASTACCESS" is less than "5/1/2006" and cell "Gen.EMAIL" is "*")
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

set eMailAddressesCount to count eMailAddresses -- Obtain number of items of 'eMailAddresses' list.
if ((eMailAddressesCount > 0) and ((count firstNames) = eMailAddressesCount)) then -- Lists must be equal in items, and greater than 0.
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, contenteM_Salutation & " " & (item i of firstNames) & "," & return & return & eM_Contents)}
tell nMessage
make new to recipient at end of to recipients with properties {addressitem i of eMailAddresses)}
--send
say "Sent"
end tell
end repeat

-- quit -- Optional.
end tell
else -- This line, and the next four (4) lines, are optional.
set errorMessage to "An error occurred"
activate
say errorMessage
display dialog errorMessage buttons {"OK"} default button 1 giving up after 5
end if
end tell


On another note, would you mind briefly describing certain commands? I'm a bit confused what these commands mean, and hope you could clear up any confusion that I have.

1) The "set {firstnames,emailaddresses}" command line, what exactly does that do? is it renaming or modifying the cell values? My access privledges might not allow this...

2) Is the counting command neccessary? I understnad what it does (@ least I think I do...lol) I did get the whole script to run only once (it only needs to work once, natch) but it didn't do anything; other than open up and log into the database file, filter the records, then pull up mail, and then the mac says "Sent" <---nice touch!

3)Lastly, what exactly do the last 5 lines do exactly? Is it to combat any errors that arise?

Other than that, I'm feverishly searching for solutions, it seems the only one able to script well (not to mention, help) is barhar. Many thanks again, I hope we can get this to work!
Reply With Quote