Create Palm Desktop memo entry from selection

Dec 11, '03 10:24:00AM

Contributed by: Anonymous

Cocoa services are cool, and "Make entry from selection" kinda services work very well with Cocoa apps such as Macjournal and Sbook. Well, I like and am sticking with Palm Desktop (it is still the fastest of them all, and syncs smoothest with my Clie), but since it is a Carbon app, it doesn't support services. I really want to select text in the frontmost application and make a memo out of it; needing it with Safari the most, mainly to grab recipes from Epicurious or some other notables, and stick them in the memo list.

Well, with a lot of help from the nice listers at Macscripter.net, I came up with the following AppleScript. Save it into ~/Library/Scripts (I use the name makeMemo.applescript), make sure the AppleScript menu is visible in your menubar, and off you go. When you want to make a memo in Palm Desktop while surfing in Safari, just select the text and choose the makeMemo script from your menubar. A new memo item will be created. Tweak as desired.


tell application "Safari" to set contentsTxt to ¬
 (do JavaScript "getSelection()" in document 1)
set contentsTxt to «class ktxt» of (result as record)
set titleTxt to text 1 thru 20 of contentsTxt
tell application "Palm Desktop"
  activate
  try
    make new memo with properties ¬
     {title:titleTxt, contents:contentsTxt}
    on error msg
     display dialog msg
  end try
end tell
[robg adds: I haven't tested this one...]

Comments (29)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20031204215859912