• 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
Another 'Mail' hassle
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Another 'Mail' hassle


  • Subject: Another 'Mail' hassle
  • From: Brian Christmas <email@hidden>
  • Date: Wed, 26 Apr 2017 01:07:03 +1000

G’day scripters.

New problems. In trying to import old message, from mailboxes on an external disk, I tried the script below, which errors with…

Can’t make «class cfol» "Year 2017.mbox" of «class cfol» "0D4C39D0-EEEB-40C9-AC05-657E6894D805" of «class cfol» "V4" of «class cfol» "Mail" of «class cfol» "Library" of «class cfol» "OzSanta" of «class cfol» "Users" of «class cdis» "Daily Backup" of application "Finder" into the expected type.


I then tried the GUI approach from above Menu, but the ‘Import’ sheet uses a pop up button to select the desired mailbox, that I cannot set the value of.

Any takers on how to import mailboxes as ‘Import’ mailboxes, that I can then check the included emails against existing ones (this App is designed for recovery from any crash).

I need to make everything automatic. Everything else my main app saves I can retrieve and update, but this one with Mail is full of dead ends.

Regards

Santa

property cccDisk : ""
set theStart to true
try
tell application "Finder"
activate
set my cccDisk to "Daily Backup"
set theExternalDisk to disk (my cccDisk)
set folderNames to name of (folders of (folder "Users" of theExternalDisk))
repeat with eachname in folderNames
if eachname is not in {"Guest", "Shared"} then
set theExternalUser to folder eachname of (folder "Users" of theExternalDisk)
exit repeat
end if
end repeat
set theMailStorage to every folder of folder "V4" of folder "Mail" of folder "Library" of theExternalUser
set repeatExit to true
repeat with eachCheckFolder in theMailStorage
set eachCycleFolder to every folder of eachCheckFolder
repeat with eachFolder in eachCycleFolder
if (name of eachFolder as text) starts with "Year" and name extension of eachFolder is "mbox" then
my importMail(eachFolder)
end if
end repeat
end repeat
end tell
end try

on importMail(eachFolder)
tell application "Mail"
try
import Mail mailbox at eachFolder
on error errmsg
tell application "System Events" to display dialog errmsg giving up after 20
end try
end tell
end importMail


 _______________________________________________
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: Another 'Mail' hassle
      • From: Brian Christmas <email@hidden>
  • Prev by Date: Recursing through folders and files
  • Next by Date: Re: TextEdit things
  • Previous by thread: Recursing through folders and files
  • Next by thread: Re: Another 'Mail' hassle
  • Index(es):
    • Date
    • Thread