Saturday, December 16, 2017

#1 2016-02-16 07:25:46 pm

Santa
Member
From:: Land of Oz
Registered: 2006-07-27
Posts: 486

Help with saving Mail message as Raw Message Source

G'day

I've struck a problem in that a ASObjC script that uses the GUI to save a copy of a Mail Message runs very, very slowly. I runs at less than a second in vanilla Applescript, but over 15 seconds in my ASOObjC project. Time saving is essential.

So, I'm trying to save the opened email directly, but can't get the terminology right.

Any advice, please?

Regards

Santa

Applescript:


property pathtodesktop : path to desktop as text
property printDateTimeName : (current date) as text

tell application "Mail"
   activate
   open message 1 of inbox # mailbox "* items to manually process"
   # DOESN'T WORK
save window 1 in ((path to desktop) & printDateTimeName & ".eml" as rich text) as native format
   save window 1 in ((path to desktop) & printDateTimeName & ".eml" as rich text) as Raw Message Source
   try
       close every window
   end try
end tell

# from mail dictionary

# saveable file format enum
# native format : Native format

SLOW SCRIPT IN ASObjC

Applescript:


property pathtodesktop : path to desktop as text
property printDateTimeName : (current date) as text

tell application "Mail"
   activate
   open message 1 of mailbox "* items to manually process"
   tell application "System Events" to tell process "Mail"
       tell window 1
           keystroke "s" using {command down, shift down}
           select text field 1 of sheet 1
           keystroke printDateTimeName # & ".eml"
           tell pop up button 1 of group 1 of sheet 1
               click
               click menu item 3 of menu 1
           end tell
       end tell
       click button 1 of sheet 1 of window 1
       try
           keystroke return
       end try
           end tell
   try
       close every window
   end try
end tell

Model: late 2014 i7 iMac
AppleScript: 2.8.1
Browser: Safari 601.4.4
Operating System: Mac OS X (10.10)


Just an enthusiastic old fart of an Apple user since the IIe days

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)