Here’s a greatly simplified version of the script I posted.
It accessess the saved Mail Folders of the startup disk, as I wondered if the offending command was failing because it was addressing an external source.
Still doesn’t work.
If no one thinks there’s a scripting error, I’ll lodge a bug.
property cccDisk : ""
my nowCopyInformation()
on nowCopyInformation()
try
tell application "Finder"
set (my cccDisk) to startup disk
activate
try
set p to 1
tell application "Finder"
activate
set theExternalDisk to (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 p to 2
set eachCycleFolder to every folder of eachCheckFolder
repeat with eachFolder in eachCycleFolder
set p to 3
if (name of eachFolder as text) starts with "Year " and name extension of eachFolder is "mbox" then
set p to 4
tell application "System Events" to display dialog (name of eachFolder) as text giving up after 2
set p to 5
set eachFolder to eachFolder as alias
set p to 6
my importMail(eachFolder)
end if
end repeat
end repeat
end tell
on error errmsg
tell application "System Events" to display dialog errmsg & " p = " & p giving up after 20
end try
end tell
on error errmsg
tell application "System Events" to display dialog errmsg
end try
#
#
#
end nowCopyInformation
on importMail(eachFolder)
tell application "Mail"
activate
try
say "importing"
import Mail mailbox at eachFolder
on error errmsg
tell application "System Events" to display dialog "Import " & errmsg giving up after 20
end try
end tell
end importMail