hr101

Q: Wanted: can the following OS fix be scripted and is anyone willing?

  1. Help a user find a designated folder created by Mail.app in the Finder e.g. 'Users/[your name]/Library/Mail/V2/Mailboxes/Repair.xmbox'.
  2. Then search through the folder structure and for each .emlx message just in that designated folder, open each email with TextEdit.app say, search for instances of 'base 64' and replace with '8bit' and save

 

This fix seems to address the issue being discussed here and obviously automating the steps would be a huge time saver.

MacBook Pro (15-inch Mid 2012), OS X Yosemite (10.10.2)

Posted on Apr 2, 2015 10:26 AM

Close

Q: Wanted: can the following OS fix be scripted and is anyone willing?

  • All replies
  • Helpful answers

Previous Page 2
  • by hr101,

    hr101 hr101 Apr 10, 2015 3:08 AM in response to Rich In Space
    Level 1 (0 points)
    Apr 10, 2015 3:08 AM in response to Rich In Space

    Permissions might be it. Not clear why some of my mailboxes would have a problem but indeed running the script with the same mail selected in certain mailboxes does seem to be where the script fails on closer review. When it does fail, TextEdit doesn't appear to launch at all. The script cog wheel runs for 30-40 seconds and then fails mostly without any error or pops a little red cross in the script run menu. Only when I run the script from Editor do I get the error message. I'll do more digging my side as this does seems to be me now not the script. Thanks for your patience and support so far.

  • by Rich In Space,

    Rich In Space Rich In Space Apr 10, 2015 3:36 AM in response to hr101
    Level 1 (30 points)
    Apr 10, 2015 3:36 AM in response to hr101

    I can easily add code to the AppleScript that entirely skips those files that won't open, but I can't force-open them so it won't solve your initial problem (garbage characters in message).

     

    Since your permissions is one thing I cannot see from here, I instead simulated your situation by purposely changing my permissions and other access possibilities. And surely, they gave exactly the problem you are having.

     

    You could try repair permissions with Disk Utility, but I'm not sure that will help in this case.

     

    Also, you could try to add a new line of code with one single word in it "activate" in the AS on a separate line right after  tell application "TextEdit"

    This could possibly allow you to get some more info from TextEdit on the error. Please, do so and let me know.

  • by hr101,

    hr101 hr101 Apr 10, 2015 4:07 AM in response to Rich In Space
    Level 1 (0 points)
    Apr 10, 2015 4:07 AM in response to Rich In Space

    I'm mostly only selecting one mail at a time as these are littered across my file structure and your script allows me to leave them in whatever mailbox they are over the initial solution. However I was wrong around certain folders being a problem as I've now moved the same couple of emails around and they fail regardless of what folder they are in. Might need a rebuild on some mailboxes to see if that helps.

    The document “484485.emlx” could not be opened. The file doesn’t exist.

    The document “463367.emlx” could not be opened. The file doesn’t exist.

     

    I can now see that a dialog box above sits hidden in another space (only visible when you visit the space and not in the Spaces overview which is why I didn't spot these for a while) and that's causing the script to time out (the same dialog is there when I run the script again later on another email) and drops out each time as the dialog is ignored too long. Once the dialog is dismissed Script Editor then says what we now know:

    error "TextEdit got an error: Can’t get document 1. Invalid index." number -1719 from document 1

     

    Interestingly though TextWrangler does see the emls so reverting to the manual process I've fixed the two emls above so overall I have two workarounds which look like they will fix all my problems between them. Am more than happy to help you troubleshoot this further if there's any further work you want to do on the script, but also happy to let you get back to other things at this point. Many thanks again.

  • by Rich In Space,

    Rich In Space Rich In Space Apr 10, 2015 5:19 AM in response to hr101
    Level 1 (30 points)
    Apr 10, 2015 5:19 AM in response to hr101

    Still curious though. A final ettempt…

    I suppose the messages "The document “484485.emlx” could not be opened. The file doesn’t exist." were found inside TextEdit, or…?

    What do you find if you Spotlight "484485.emlx" or "463367.emlx"? Do these files even exist? In what folders do they recide then?

    Also, yes do rebuild the mail boxes once.

  • by Rich In Space,

    Rich In Space Rich In Space Apr 10, 2015 5:22 AM in response to hr101
    Level 1 (30 points)
    Apr 10, 2015 5:22 AM in response to hr101

    I'm leaving a version of the AS-script that simply ignores unaccessable mail files here:

    https://drive.google.com/open?id=0B7Gv-iaTLONqLVVzaS1pTVIycm8&authuser=0

Previous Page 2