• 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
Re: Making a list from external data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Making a list from external data


  • Subject: Re: Making a list from external data
  • From: Christopher Stone <email@hidden>
  • Date: Fri, 19 Aug 2016 13:46:34 -0500

On Aug 17, 2016, at 08:48, debt <email@hidden> wrote:
I want to remove the list of email accounts:


Hey Marc,

You can save a list of email accounts as type list.

-------------------------------------------------------------------------------------------

set l to {"one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten"}

set f to (path to downloads folder as text) & "test.lst"

writeFile(l, f, 0, list)

read alias ((path to downloads folder as text) & "test.lst") as list

-------------------------------------------------------------------------------------------
--» HANDLERS
-------------------------------------------------------------------------------------------
on writeFile(srcData, targetFile, startPosition, dataType)
   try
      set fileRef to open for access targetFile with write permission
      if startPosition = 0 then
         set eof of fileRef to 0
      end if
      write srcData to fileRef as dataType starting at startPosition
      close access fileRef
   on error errMsg number errNum
      try
         close access fileRef
      end try
      error "Error in handler: writeFile of library: gen.lib" & return & return & errMsg
   end try
end writeFile
-------------------------------------------------------------------------------------------

Or you could use a simple text file containing the account names:

-------------------------------------------------------------------------------------------
set accountList to read alias ((path to downloads folder as text) & "accounts.txt") using delimiter linefeed as «class utf8» -- File containing Mail account names 1 per line.

tell application "Mail"
   repeat with i in accountList
      set contents of i to account i
   end repeat

   

   accountList

   

end tell
-------------------------------------------------------------------------------------------

--
Best Regards,
Chris

 _______________________________________________
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: debt <email@hidden>
References: 
 >Making a list from external data (From: debt <email@hidden>)

  • Prev by Date: Re: Making a list from external data
  • Next by Date: Re: Making a list from external data
  • Previous by thread: Re: Making a list from external data
  • Next by thread: Re: Making a list from external data
  • Index(es):
    • Date
    • Thread