View Single Post
  #13  
Old May 16th, 2008, 03:15 PM
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
Reply to '1)':

set {firstNames, eMailAddresses} to {(every cell of document 1 whose name is firstNameCell), (every cell of document 1 whose name is eMailAddressCell)}

... is no different than ...

set firstNames to (every cell of document 1 whose name is firstNameCell)
set eMailAddresses to (every cell of document 1 whose name is eMailAddressCell)

... The line of code ...

set firstNames to (every cell of document 1 whose name is firstNameCell)

... creates a list, titled 'firstNames', which contains all of the 'firstNameCell's of the database. Where 'firstNameCell' is 'GEN.LASTACCESS', in your database.

The line of code ...

set eMailAddresses to (every cell of document 1 whose name is eMailAddressCell)

... creates a list, titled 'eMailAddresses', which contains all of the 'eMailAddressCell's of the database. Where 'eMailAddressCell' is 'Gen.EMAI', in your database.

Reply to '2)':

Yes. The comment '-- Lists must be equal in items, and greater than 0.' as the end of the line of code is self explanatory.

If you look at the line above the 'say "Sent"' ... it is '--send'. You will have to remove the two '--'es (minus signs). The duo minuses 'comments out' the line. I did not realize I did not remove the '--'s when pasting the code into the reply. [I had no intention of sending countless e-Mail messages while testing the code, thus the '--'es ]

Remove the '--'es, and the script will actually send each person an e-Mail message.

Reply to '3)':

One has to look as the code ...

if ((eMailAddressesCount > 0) and ((count firstNames) = eMailAddressesCount)) then -- Lists must be equal in items, and greater than 0.
.
.
.
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

..., Thus, if there are not an equal number of 'First_Name' and 'eMail_Address' items in the respective 'firstName' and 'eMailAddresses' lists - the code beneath 'else' is executed. You would hear 'An error occurred' and will see a dialog box, for up to five (5) seconds, displaying 'An error occurred'.

--

In conclusion:

Locate ...

--send

..., rename it as ...

send

..., and execute the code.
Reply With Quote