Hello,
I’m refactoring this script (https://www.surfshopcart.com/info/scripts/applescript-mail-el-capitan.php) to better suit my needs and I’ve run across a problem I can’t solve.
I want to remove the list of email accounts:
set theAccountList to ¬ {¬ {account "info" of application "Mail", 15}, ¬ {account "orders" of application "Mail", 45}, ¬ {account "support" of application "Mail", 60}, ¬ {account "personal" of application "Mail", 90}, ¬ {account "G_Mail" of application "Mail", 20}, ¬ {account "Yahoo_Mail" of application "Mail", 30} ¬ }
and place it in an external text file for easier updating via another script. However, I can’t find how to import it back into the script as a usable list. Here’s what I’ve got so far:
set the_accounts_list to {} set the_accounts to paragraphs of (read POSIX file “/User/.../accounts.data") repeat with each_account in the_accounts if length of each_account is greater than 0 then set end of the_accounts_list to each_account as list end if end repeat
tell application "Mail" repeat with each_account in the_accounts_list set the_account to item 1 of each_account as string set my_array to my theSplit(the_account, ",") set the_interval to item 2 of my_array if the_interval ≠ 0 then set theMod to the_minute_count mod the_interval if (theMod = 0) then check for new mail for the_account end if end if end repeat end tell
on theSplit(the_string, the_delimiter) set old_delimiters to AppleScript's text item delimiters set AppleScript's text item delimiters to the_delimiter set the_array to every text item of the_string set AppleScript's text item delimiters to old_delimiters return the_array end theSplit
What’s wrong with the above code? Also, in what format should the data be in the external file?
Thanks, Marc OSX 10.11.6
|