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
|