Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Create Palm Desktop memo entry from ANY app' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Create Palm Desktop memo entry from ANY app
Authored by: klktrk on Dec 11, '03 06:00:03PM
The way to get this to work from any app is to require the user to first hit Cmd+C to put the selection into the clipboard. then you can just use this script. (There is no universal way in AppleScript to get at the selection in any and every app-- even with UI scripting):
set selectedText to do shell script "pbpaste"
display dialog "Enter a title for your memo: " ¬
default answer "" default button "OK"
set titleText to text returned of result
set confirmationMessage to "This is your new memo
Title: " & titleText & "

Body: " & selectedText

display dialog the confirmationMessage ¬
buttons {"Cancel", "Send to Palm memo"} ¬ 
default button 2 with icon 1 giving up after 10

set userChoice to the button returned of the result


if userChoice is "Send to Palm memo" then
	tell application "Palm Desktop"
  activate
  try
    make new memo with properties ¬
     {title:titleText, contents:selectedText}
    on error msg
     display dialog msg
  end try
end tell
end if


Look out for line breaks!

[ # ]
Create Palm Desktop memo entry from ANY app
Authored by: sjk on Dec 11, '03 06:27:31PM

Thanks for the script. Hope to get it working since it could become quite useful.

Pretty sure I've got it copied and compiled properly tho' every test returns this:

Palm Desktop got an error: Can't make some data into the expected type.

Entries with only a date field show up in Palm Desktop Memos but disappear when its opened.

I'm running 10.3.1, PD 4.1.



[ # ]
Create Palm Desktop memo entry from ANY app
Authored by: pkishor on Dec 11, '03 06:59:13PM

as is, this script won't work. The reason is Unicode -- PD doesn't support Unicode, so you have to extract plain text out of the selection. Look out for the following line in the original script I wrote

<code>
set contentsTxt to «class ktxt» of (result as record)
</code>

without that, an empty memo will be created, and will promptly disappear.



[ # ]
Create Palm Desktop memo entry from ANY app
Authored by: sjk on Dec 11, '03 07:14:31PM

Ahh, thanks for the explanation. I figured there was a good reason for doing that.



[ # ]
Create Palm Desktop memo entry from ANY app
Authored by: timswan on Dec 13, '03 09:53:37AM

Keep in mind that many of us are not applescripters, so when you say "Watch the line breaks" many of us aren't quite sure what you mean. Should the script match exactly what is shown on the html page, including the "¬", or should they be deleted to make one line.

Little things like that are important when you're trying to spread your extremely helpful code. I'm just totally unable to get any of these scripts to work -- I'm starting to think I have a script editor problem. I keep getting a Syntax Error: Expected "given", "with", "without", other parameter name, etc. but found "{". no matter how carefully I type in the code.



[ # ]