Title: New Note from Selected Text (trying to write)
The "Create Note From Message" script that shipped with E is useful, but many times I want to save just a _portion_ of a message to a new note.
I'd like to highlight a selection of text/pictures/whatever in a message, then run a script that pastes it into a new note. I’d also like the note to be linked to the message it originated from, like the “Create Note..” script.

This would come in handy when dealing with mailing list digests. I often save portions of the digests (often whole messages) as notes to refer to later. I know I can just copy->new note->paste, but with E's contextual menus "Execute Script >" option, it could be done so much faster.

I looked around AppleScript Central, as well as Paul and Allen's Pages. I didn't find any scripts that did this.

So, I tried to shoehorn one together myself (laugh here), out of the "Create Note From Message" and the "Save Selection" scripts (both are the vanilla scripts that shipped with E). I thought I could use the part of "Save Selection" script that recognises selected text, then use the parts of "Create Note..." that pastes it into a Note and creates the link.

 Here's what I wound up with. It doesn't work. I get the second error dialog (”
There was an error saving the selection “). I had to cut the link part out completely or the script wouldn’t compile. Can anyone tell me where I’m going wrong?


tell application "Microsoft Entourage"
    activate
    
    set theText to ""
    
    try
       set theText to the selection
        --
trigger error if no text
       if theText is "" then
       end if
   on error
       display dialog ¬
            "This script works on text selected in a message." buttons {"OK"}
        set theText to ""
    end try
   
    
    try
       if theText is not "" then
           
            --
get the information from the message, and store it in variables
           set theName to subject of theText
            set theCategory to category of theText
            set theContent to content of theText
            
            --
create a new note with the information from the message
           set newNote to make new note with properties {name:theName, category:theCategory, content:theContent}
        end if
   on error
       display dialog "There was an error saving the selection." buttons {"OK"}
    end try
   
end tell




--
CMS

Reply via email to