text
stringlengths
0
15.7k
source
stringlengths
6
112
Controller's control(37)
previous.scpt
set DIALOG_TITLE to "Email Merge"
Email Merge to Contacts.applescript
set BUTTON_OK to "OK"
Email Merge to Contacts.applescript
set BUTTON_CANCEL to "Cancel"
Email Merge to Contacts.applescript
set BUTTON_YES to "Yes"
Email Merge to Contacts.applescript
set BUTTON_NO to "No"
Email Merge to Contacts.applescript
set BUTTON_MAIL to "Mail"
Email Merge to Contacts.applescript
set BUTTON_OUTLOOK to "Outlook"
Email Merge to Contacts.applescript
set PROMPT_TESTING_MODE to "Do you want to run in testing mode?"
Email Merge to Contacts.applescript
set PROMPT_WHAT_ADDRESS to "Send all messages to:"
Email Merge to Contacts.applescript
set ANSWER_EMAIL to "[email protected]"
Email Merge to Contacts.applescript
set PROMPT_WHICH_PROVIDER to "Which provider?"
Email Merge to Contacts.applescript
set PROMPT_WHICH_GROUP to "Which group shall be used?"
Email Merge to Contacts.applescript
set PROMPT_NO_VALID_EMAILS to "The group of contacts contained no valid email addresses."
Email Merge to Contacts.applescript
set PROMPT_WHICH_ADDRESS_TYPE to "Which email-address type(s) to use?"
Email Merge to Contacts.applescript
set PROMPT_WHICH_TEMPLATE to "Which template to use?"
Email Merge to Contacts.applescript
set PROMT_PAUSING to "Pausing between batches. Processing will resume at %s. (this alert will be automatically dismissed)"
Email Merge to Contacts.applescript
set PROMPT_DONE to "%d emails were sent to %d contacts."
Email Merge to Contacts.applescript
set REASON_NO_ADDRESS to "No email addresses"
Email Merge to Contacts.applescript
set REASON_DUPLICATE_ADDRESS to "Duplicate address"
Email Merge to Contacts.applescript
set REASON_WRONG_ADDRESS_TYPE to "Wrong address type"
Email Merge to Contacts.applescript
set theVariables to {"%%FirstName%%", "%%LastName%%", "%%DisplayName%%", "%%Company%%", "%%EmailAddress%%", "%%Date%%", "%%Time%%"}
Email Merge to Contacts.applescript
set batchSize to 50 -- # of messages to deliver sequentially; recommended: 50
Email Merge to Contacts.applescript
set thePause to 1 -- # of minutes between batches; recommended: 5
Email Merge to Contacts.applescript
set Helper to load script (path to resource "HelperLibrary.scpt" in directory "Scripts")
Email Merge to Contacts.applescript
display dialog PROMPT_WHICH_PROVIDER with title DIALOG_TITLE buttons {BUTTON_MAIL, BUTTON_OUTLOOK} default button BUTTON_MAIL
Email Merge to Contacts.applescript
if result = {button returned:BUTTON_MAIL} then
Email Merge to Contacts.applescript
set thePlugin to load script (path to resource "MailPlugin.scpt" in directory "Scripts")
Email Merge to Contacts.applescript
else if result = {button returned:BUTTON_OUTLOOK} then
Email Merge to Contacts.applescript
set thePlugin to load script (path to resource "OutlookPlugin.scpt" in directory "Scripts")
Email Merge to Contacts.applescript
set testingMode to (display dialog PROMPT_TESTING_MODE with title DIALOG_TITLE buttons {BUTTON_YES, BUTTON_NO} default button BUTTON_YES)
Email Merge to Contacts.applescript
if result = {button returned:BUTTON_NO} then
Email Merge to Contacts.applescript
set testingMode to false
Email Merge to Contacts.applescript
else if result = {button returned:BUTTON_YES} then
Email Merge to Contacts.applescript
set testingMode to true
Email Merge to Contacts.applescript
set testingAddress to text returned of (display dialog PROMPT_WHAT_ADDRESS default answer ANSWER_EMAIL with title DIALOG_TITLE buttons {BUTTON_OK} default button BUTTON_OK)
Email Merge to Contacts.applescript
if result is false then return
Email Merge to Contacts.applescript
set groupNames to thePlugin's getGroups()
Email Merge to Contacts.applescript
set groupNames to Helper's simple_sort(the groupNames)
Email Merge to Contacts.applescript
set groupName to (choose from list groupNames with title DIALOG_TITLE with prompt PROMPT_WHICH_GROUP)
Email Merge to Contacts.applescript
set theContacts to thePlugin's getContacts(groupName)
Email Merge to Contacts.applescript
if (count of theTypes of theContacts) = 0 then
Email Merge to Contacts.applescript
display dialog PROMPT_NO_VALID_EMAILS with title DIALOG_TITLE buttons {BUTTON_OK} default button BUTTON_OK
Email Merge to Contacts.applescript
set theTypes to (choose from list (theTypes of theContacts) with title DIALOG_TITLE with prompt PROMPT_WHICH_ADDRESS_TYPE with multiple selections allowed)
Email Merge to Contacts.applescript
set theSubjectIds to thePlugin's getTemplates()
Email Merge to Contacts.applescript
set theSubjectIds to Helper's simple_sort(the theSubjectIds)
Email Merge to Contacts.applescript
set theChoice to (choose from list theSubjectIds with title DIALOG_TITLE with prompt PROMPT_WHICH_TEMPLATE)
Email Merge to Contacts.applescript
set n to Helper's find("[", theChoice)
Email Merge to Contacts.applescript
set m to Helper's find("]", theChoice)
Email Merge to Contacts.applescript
set theID to (text (n + 1) through (m - 1) of (theChoice as text)) as text
Email Merge to Contacts.applescript
set startTime to (current date)
Email Merge to Contacts.applescript
set iterator to 0 -- tracks batch size
Email Merge to Contacts.applescript
set recordsProcessed to 0 -- the number of contacts
Email Merge to Contacts.applescript
set messagesSent to 0 -- the number of messages actually sent
Email Merge to Contacts.applescript
set theAddressesProcessed to {} -- track email address
Email Merge to Contacts.applescript
set theResults to {} -- track results
Email Merge to Contacts.applescript
repeat with theContact in (theRecords of theContacts)
Email Merge to Contacts.applescript
repeat 1 times -- fake loop 0
Email Merge to Contacts.applescript
set recordsProcessed to recordsProcessed + 1
Email Merge to Contacts.applescript
if length of (emailAddresses of theContact) = 0 then
Email Merge to Contacts.applescript
set theResult to {displayName:(displayName of theContact), companyName:(companyName of theContact), emailAddress:null, type:null, sent:false, reason:REASON_NO_ADDRESS}
Email Merge to Contacts.applescript
exit repeat --loop 0
Email Merge to Contacts.applescript
repeat with theEmailAddress in emailAddresses of theContact
Email Merge to Contacts.applescript
repeat 1 times -- fake loop 1
Email Merge to Contacts.applescript
if theTypes does not contain (theType of theEmailAddress) then
Email Merge to Contacts.applescript
set theResult to {displayName:(displayName of theContact), companyName:(companyName of theContact), emailAddress:(theAddress of theEmailAddress), type:(theType of theEmailAddress), sent:false, reason:REASON_WRONG_ADDRESS_TYPE}
Email Merge to Contacts.applescript
exit repeat --loop 1
Email Merge to Contacts.applescript
else if theAddressesProcessed contains (theAddress of theEmailAddress) then
Email Merge to Contacts.applescript
set theResult to {displayName:(displayName of theContact), companyName:(companyName of theContact), emailAddress:(theAddress of theEmailAddress), type:(theType of theEmailAddress), sent:false, reason:REASON_DUPLICATE_ADDRESS}
Email Merge to Contacts.applescript
set theContent to thePlugin's getContent(theID)
Email Merge to Contacts.applescript
set theContent to Helper's personalize(theContent, theVariables, theContact, (theAddress of theEmailAddress))
Email Merge to Contacts.applescript
set theRecipient to {thename:null, theAddress:null}
Email Merge to Contacts.applescript
if testingMode then
Email Merge to Contacts.applescript
set theRecipient to {thename:(displayName of theContact), theAddress:testingAddress}
Email Merge to Contacts.applescript
set theRecipient to {thename:(displayName of theContact), theAddress:(theAddress of theEmailAddress)}
Email Merge to Contacts.applescript
thePlugin's copyAndSendMessage(theID, theContent, theRecipient)
Email Merge to Contacts.applescript
set theResult to {displayName:(displayName of theContact), companyName:(companyName of theContact), emailAddress:(theAddress of theEmailAddress), type:(theType of theEmailAddress), sent:true, reason:null}
Email Merge to Contacts.applescript
if theAddressesProcessed does not contain (theAddress of theEmailAddress) then
Email Merge to Contacts.applescript
copy (theAddress of theEmailAddress) to the end of theAddressesProcessed
Email Merge to Contacts.applescript
set iterator to iterator + 1
Email Merge to Contacts.applescript
set messagesSent to messagesSent + 1
Email Merge to Contacts.applescript
if ((count of theRecords of theContacts) - recordsProcessed) > 0 and (iterator is batchSize) then
Email Merge to Contacts.applescript
set iterator to 0
Email Merge to Contacts.applescript
display dialog Helper's format_string(PROMT_PAUSING, {((current date) + (60 * thePause) as text)}) with title DIALOG_TITLE buttons {BUTTON_OK} giving up after 5
Email Merge to Contacts.applescript
delay (60 * thePause)
Email Merge to Contacts.applescript
end repeat --/fake 1
Email Merge to Contacts.applescript
end repeat -- email addresses
Email Merge to Contacts.applescript
end repeat --/fake 0
Email Merge to Contacts.applescript
end repeat --contacts
Email Merge to Contacts.applescript
display dialog Helper's format_string(PROMPT_DONE, {messagesSent, recordsProcessed}) with title DIALOG_TITLE buttons {BUTTON_OK} default button BUTTON_OK
Email Merge to Contacts.applescript
-- { -- firstName: Jane, lastName: Doe, displayName: Jane Doe, companyName: Acme, -- emailAddresses: -- { -- {theType:Home, theAddress:[email protected]},
Email Merge to Contacts.applescript
set theSource to {}
Show Raw Mail Message in Mail.applescript
if selectedMessages is {} then
Show Raw Mail Message in Mail.applescript
display dialog "Please select a message first"
Show Raw Mail Message in Mail.applescript
error -128
Show Raw Mail Message in Mail.applescript
repeat with theMessage in selectedMessages
Show Raw Mail Message in Mail.applescript
set end of theSource to source of theMessage & return
Show Raw Mail Message in Mail.applescript
set theMessage to make new outgoing message with properties {content:theSource, visible:true}
Show Raw Mail Message in Mail.applescript
display alert "準備はできていますか?" & return & return & "確認:" & return & "ホスト名ごとに1つずつ改行を入れた" & return & "テキストファイルを用意してください。" & return & "※LAN接続しているもののみ取得できます。" & return & "※一番最後の行に改行を入れ忘れないこと!" & return & return & "例:" & return & "ホスト名A(改行)" & return & "ホスト名B(改行)" & return & "ホスト名C(改行)" buttons {"キャンセル", "OK"} default button 2
hostname_to_ip_address.applescript
if button returned of result is "キャンセル" then
hostname_to_ip_address.applescript