Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I have found a solution to this. I found that the data provided in the mode "kUTTypeData" gave me enough data to grab the files directly from the mail.app mailbox. </p> <p>In the mbox folder, there is a folder with a long sequence of numbers and dashes, there was no trace of this name anywhere in the mailbox hierarchy, but since this only contains this folder and an info.plist file, I used this function to grab that name: Update: implemented regexp check since the folder sometimes contains sub-mailboxes that can have a longer name...</p> <pre><code>-(NSString*)FindCodedFolderInMailbox:(NSString*)mailboxpath { NSString *uuid_regexp = @"[A-F0-9]{8}-[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{12}"; NSPredicate *uuid_test = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", uuid_regexp]; NSFileManager *fileManager = [NSFileManager defaultManager]; NSArray *fileList = [fileManager contentsOfDirectoryAtPath:mailboxpath error:nil]; for (NSString * file in fileList) { if ([uuid_test evaluateWithObject: file]){ return file; } } return nil; } </code></pre> <p>Then the section where I find there is no "NSPromiseContentsPboardType", but instead a "Super-secret Automator pasteboard type", I wrote the following section (There is some NSLog entries I intend to remove, but here it is: </p> <pre><code>} else if ( [[pboard types] containsObject:@"Super-secret Automator pasteboard type"] ) { NSFileManager *fileManager = [NSFileManager defaultManager]; // Create the URL for the destination folder and ensure it exists. NSURL *applicationFilesDirectory = [self applicationFilesDirectory]; NSURL *url = [applicationFilesDirectory URLByAppendingPathComponent:@"documents"]; BOOL isDir; if (!([fileManager fileExistsAtPath:[url path] isDirectory:&amp;isDir] &amp;&amp; isDir)) { NSError * error = nil; [ fileManager createDirectoryAtURL:url withIntermediateDirectories: YES attributes:nil error:&amp;error]; if (error) { [[NSApplication sharedApplication] presentError:error]; } } BOOL ok = false; // locate the mailbox path.... NSString *mailboxpath = [pboard stringForType:@"MV Super-secret message transfer pasteboard type"]; NSLog(@"Mailboxpath: %@", mailboxpath); NSString * codedFolder = [self FindCodedFolderInMailbox:mailboxpath]; if (codedFolder) { NSString * codedpath = [NSString stringWithFormat:@"file://%@/%@/Data", mailboxpath, codedFolder]; NSURL * mb1 = [NSURL URLWithString:codedpath]; NSLog(@"Directory:%@", mb1); NSArray *msgArray = [pboard propertyListForType:@"Super-secret Automator pasteboard type"]; if (msgArray) { for (NSDictionary *msg in msgArray) { // Locate the message.... NSNumber * msgID = [msg valueForKey:@"id"]; NSLog(@"Melding(%@):%@", msgID, msg); NSString * filename = [NSString stringWithFormat:@"%@.emlx", msgID]; // second and first letter of id NSString * idSec = [[msgID stringValue]substringWithRange:(NSRange){1, 1}]; NSString * idFirst = [[msgID stringValue]substringWithRange:(NSRange){0, 1}]; NSString * subpath = [NSString stringWithFormat:@"%@/%@/Messages/%@",idSec, idFirst, filename]; NSURL * thisFilePath = [mb1 URLByAppendingPathComponent:subpath]; if ([fileManager fileExistsAtPath:[thisFilePath path]]) { NSURL *destpath = [url URLByAppendingPathComponent:filename]; NSError * error = nil; [fileManager copyItemAtURL:thisFilePath toURL:destpath error:&amp;error]; if (error) { [[NSApplication sharedApplication]presentError:error]; } else { [self ParseEmlMessageforPath:[destpath path] filename:filename]; } } } } } </code></pre> <p>And here we go.... :-)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload