Hi,
I am trying to write a simple AppleScript that I can put in my Script Menu.
What I intend the script to do is this:
*get the selected text in the foremost application.
*replace that text with HTML-style tags around it.
So far I am having problems getting the current selection.
the following script has different results depending on the app:
Code:
tell application someApp
get the selection
end tell
when someApp == Script Editor
it returns:
Code:
characters 57 thru 64 of document 1
but when someApp == textEdit it returns:
Code:
"TextEdit got an error: NSCannotCreateScriptCommandError"
In fact I can't see any way of getting the selected text the document at all.
Is it possible (without resorting to UIScripting?)