text stringlengths 0 15.7k | source stringlengths 6 112 |
|---|---|
set recipientGroupName to name of recipientGroup | lns3.scpt |
else -- multiple groups, prompt the user to pick one | lns3.scpt |
set theseGroupNames to the name of every group | lns3.scpt |
set recipientGroupName to ¬ | lns3.scpt |
(choose from list theseGroupNames with prompt ¬ | lns3.scpt |
"Pick the recipient Contacts group:" default items (item 1 of theseGroupNames)) | lns3.scpt |
if recipientGroupName is false then error number -128 | lns3.scpt |
set recipientGroupName to recipientGroupName as string | lns3.scpt |
set recipientGroup to group recipientGroupName | lns3.scpt |
set peopleCount to the count of people of recipientGroup | lns3.scpt |
error number 10006 | lns3.scpt |
if errorNumber is 10000 then | lns3.scpt |
set errorNumber to "NO DEFAULT CARD" | lns3.scpt |
set errorMessage to ¬ | lns3.scpt |
"No person in this Contacts database is set to be the default card or “My Card.” Select a person and choose “Make This My Card” from the Card menu." | lns3.scpt |
else if errorNumber is 10001 then | lns3.scpt |
set selection to my card | lns3.scpt |
set errorNumber to "MISSING SENDER INFO" | lns3.scpt |
"The current default card is missing a value for the First Name or Last Name fields." | lns3.scpt |
else if errorNumber is 10002 then | lns3.scpt |
set errorNumber to "MISSING EMAIL ADDRESS" | lns3.scpt |
"The current default card is missing a value for the email address field." | lns3.scpt |
else if errorNumber is 10003 then | lns3.scpt |
set errorNumber to "MISSING MAILING ADDRESS" | lns3.scpt |
"The current default card is missing a value for the address fields." | lns3.scpt |
else if errorNumber is 10004 then | lns3.scpt |
set errorNumber to "MISSING PHONE NUMBER" | lns3.scpt |
"The current default card is missing a value for the phone number field." | lns3.scpt |
else if errorNumber is 10005 then | lns3.scpt |
set errorNumber to "MISSING GROUPS" | lns3.scpt |
"There are no groups in the current contact database." | lns3.scpt |
else if errorNumber is 10006 then | lns3.scpt |
set errorNumber to "MISSING PEOPLE" | lns3.scpt |
"The chosen Contacts group contains no people." | lns3.scpt |
if errorNumber is not -128 then | lns3.scpt |
display alert (errorNumber as string) message errorMessage | lns3.scpt |
set thisDirectoryHFSPath to (path to temporary items folder) as string | lns3.scpt |
if the (count of documents) is not 0 then error number 10000 | lns3.scpt |
set userTemplateNames to the name of every template whose id of it begins with "User/" | lns3.scpt |
if userTemplateNames is {} then error number 10001 | lns3.scpt |
set the chosenTemplateName to ¬ | lns3.scpt |
(choose from list userTemplateNames with prompt ¬ | lns3.scpt |
"Pick the tagged Pages template to use:" default items (item 1 of userTemplateNames)) | lns3.scpt |
if chosenTemplateName is false then error number -128 | lns3.scpt |
set chosenTemplateName to chosenTemplateName as string | lns3.scpt |
display dialog "Enter the name to use for the exported document:" default answer "" | lns3.scpt |
set thisDocName to the text returned of the result | lns3.scpt |
if thisDocName is not "" then | lns3.scpt |
if thisDocName does not end with ".pdf" then | lns3.scpt |
set exportDocName to thisDocName & ".pdf" | lns3.scpt |
set exportDocName to thisDocName | lns3.scpt |
display dialog "Enter a password for the PDF file:" default answer ¬ | lns3.scpt |
"" buttons {"Cancel", "No Password", "OK"} default button 3 with hidden answer | lns3.scpt |
copy the result to {button returned:buttonPressed, text returned:firstPassword} | lns3.scpt |
if buttonPressed is "No Password" then | lns3.scpt |
set usePDFEncryption to false | lns3.scpt |
display dialog "Enter the password again:" default answer ¬ | lns3.scpt |
copy the result to {button returned:buttonPressed, text returned:secondPassword} | lns3.scpt |
if firstPassword is not secondPassword then | lns3.scpt |
display dialog "Passwords do no match." buttons {"Cancel", "Try Again"} default button 2 | lns3.scpt |
set providedPassword to the firstPassword | lns3.scpt |
set usePDFEncryption to true | lns3.scpt |
set defaultMessageSubject to "Document from " & senderFirstName & space & senderLastName | lns3.scpt |
display dialog "Enter the subject for the created Mail message:" default answer defaultMessageSubject | lns3.scpt |
set the outgoingMessageSubject to the text returned of the result | lns3.scpt |
if the outgoingMessageSubject is not "" then exit repeat | lns3.scpt |
display dialog "Scanning template…" buttons {"•"} default button 1 giving up after 1 | lns3.scpt |
make new document with properties {document template:template chosenTemplateName} | lns3.scpt |
tell body text of thisDocument | lns3.scpt |
set recipientFullAddressPlaceholderCount to ¬ | lns3.scpt |
the count of (every word where it is recipientFullAddressPlaceholder) | lns3.scpt |
close thisDocument saving no | lns3.scpt |
display dialog "Scan complete. Beginning Mail Merge…" buttons ¬ | lns3.scpt |
{"•"} default button 1 giving up after 1 | lns3.scpt |
set the errorLog to "MAIL MERGE ERROR LOG" | lns3.scpt |
set createdMessages to {} | lns3.scpt |
repeat with i from 1 to the peopleCount | lns3.scpt |
set skipFlag to false | lns3.scpt |
set thisPerson to person i of the recipientGroup | lns3.scpt |
set thisPersonIDString to the id of person i | lns3.scpt |
set recipientFirstName to first name of thisPerson | lns3.scpt |
if recipientFirstName is missing value then error | lns3.scpt |
set recipientFirstName to "NO-FIRST-NAME" | lns3.scpt |
set skipFlag to true | lns3.scpt |
set the errorLog to ¬ | lns3.scpt |
errorLog & return & recipientFirstName & space & thisPersonIDString | lns3.scpt |
set recipientLastName to last name of thisPerson | lns3.scpt |
if recipientLastName is missing value then error | lns3.scpt |
set recipientLastName to "NO-LAST-NAME" | lns3.scpt |
errorLog & return & recipientLastName & space & thisPersonIDString | lns3.scpt |
set recipientFullAddress to the formatted address of the first address of thisPerson | lns3.scpt |
if recipientFullAddressPlaceholderCount is not 0 and ¬ | lns3.scpt |
recipientFullAddress is missing value then error | lns3.scpt |
set recipientFullAddress to "NO-FULL-ADDRESS" | lns3.scpt |
set skipFlag to requireRecipientAddress | lns3.scpt |
errorLog & return & recipientFullAddress & space & thisPersonIDString | lns3.scpt |
set recipientEmailAddress to the value of the first email of thisPerson | lns3.scpt |
if recipientEmailAddress is missing value then error | lns3.scpt |
set recipientEmailAddress to "NO-EMAIL-ADDRESS" | lns3.scpt |
errorLog & return & recipientEmailAddress & space & thisPersonIDString | lns3.scpt |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.