• 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
build a list of mailboxes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

build a list of mailboxes


  • Subject: build a list of mailboxes
  • From: "koenig.yvan" <email@hidden>
  • Date: Sat, 08 Mar 2014 18:13:50 +0100

Hello

I wished to build a list of every mailboxes available in my Mail datas

I wrote this script :

tell application "Mail"
set liste to every mailbox
repeat with i from 1 to count liste
try
item i of liste as rich text
on error errMsg
(*Il est impossible de rendre «class mbxp» "fournisseurs/Apple/iTunes Store" of application "Mail" en type text.*)
item 2 of my decoupe(errMsg, "» " & quote)
(*fournisseurs/Apple/iTunes Store” of application "Mail" en type text.*)
item 1 of my decoupe(result, quote & " of application")
(*fournisseurs/Apple/iTunes Store*)
set item i of liste to result
end try
end repeat
end tell

my recolle(liste, return)

my writeto((path to desktop as text) & "mailboxes.txt", result, text, false)

#=====
(*
Handler borrowed to Regulus6633 - http://macscripter.net/viewtopic.php?id=36861
*)
on writeto(targetFile, theData, dataType, apendData)
-- targetFile is the path to the file you want to write
-- theData is the data you want in the file.
-- dataType is the data type of theData and it can be text, list, record etc.
-- apendData is true to append theData to the end of the current contents of the file or false to overwrite it
try
set targetFile to targetFile as text
set openFile to open for access file targetFile with write permission
if not apendData then set eof of openFile to 0
write theData to openFile starting at eof as dataType
close access openFile
return true
on error
try
close access file targetFile
end try
return false
end try
end writeto

#=====

on decoupe(t, d)
local oTIDs, l
set {oTIDs, AppleScript's text item delimiters} to {AppleScript's text item delimiters, d}
set l to text items of t
set AppleScript's text item delimiters to oTIDs
return l
end decoupe

#=====

on recolle(l, d)
local oTIDs, t
set {oTIDs, AppleScript's text item delimiters} to {AppleScript's text item delimiters, d}
set t to "" & l
set AppleScript's text item delimiters to oTIDs
return t
end recolle

#=====

Is there a way  to achieve my goal without the dirty trick deciphering an error message ?


Yvan KOENIG (VALLAURIS, France) samedi 8 mars 2014 18:12:29



 _______________________________________________
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: build a list of mailboxes
      • From: Axel Luttgens <email@hidden>
    • Re: build a list of mailboxes
      • From: Shane Stanley <email@hidden>
  • Prev by Date: Calendar running scripts?
  • Next by Date: Re: Scriptable multi-clipboard utility?
  • Previous by thread: Re: Calendar running scripts?
  • Next by thread: Re: build a list of mailboxes
  • Index(es):
    • Date
    • Thread