• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Making a list from external data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Making a list from external data


  • Subject: Making a list from external data
  • From: debt <email@hidden>
  • Date: Wed, 17 Aug 2016 06:48:48 -0700
  • Sendlaterdate: Wed, 17 Aug 2016 06:48:48 -0700

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

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Making a list from external data
      • From: Christopher Stone <email@hidden>
    • Re: Making a list from external data
      • From: debt <email@hidden>
  • Prev by Date: Re: Can't get getOSAID of «script»
  • Next by Date: Re: Making a list from external data
  • Previous by thread: Re: Can't get getOSAID of «script»
  • Next by thread: Re: Making a list from external data
  • Index(es):
    • Date
    • Thread