Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

applescripter89

macrumors newbie
Original poster
Jul 15, 2011
0
0
The problem here is to write back the modified source to view pane i.e modifying the currently viewed message.
This commented code will explain you what I am trying to achieve.
Code:
    set urtext to string
    set fileContents to string
    tell application "Microsoft Outlook"
    	set theMessage to item 1 of (get current messages)
    	set urtext to source of theMessage
    end tell
    
    --write source to the file
    set newFile to "/Users/mymac/Desktop/newTest1.html"
    set eof of newFile to 0
    open for access newFile with write permission
    write urtext to newFile
    close access newFile
    
    --modifying the contents of the email
    do shell script "/Users/mymac/Documents/'Microsoft User Data'/'Outlook Script 
    Menu Items'/test.py"
    
    --read source from the file
    set theFile to "/Users/mymac/Desktop/output3.html"
    open for access theFile
    set fileContents to (read theFile)
    close access theFile
    
    --problem here..How to write the source to the existing viewed message in 
    -- the main window without duplications
    tell application "Microsoft Outlook"
    	set the_messages to selection
    	repeat with this_message in the_messages
            
            --the line below modifies the contents, but I get two incoming mail messages
            --[one modified and one unmodified]
            set theMessage to make incoming message with properties {source:fileContents}
            
            --the line below does not modify the source of the message in view pane,
            --Remains the same as original source
            --set fileContents to source of this_message 

    	end repeat 
    end tell
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.