Hello.
I was trying to create an Applescript text filter to wrap text within custom HTML tags.
"When you apply such an item, TextWrangler will pass either the selected text (or the contents of the active document, if there is no selection) as a reference to a ‘RunFromTextWrangler’ entry point within your AppleScript, and your script should return a string which TextWrangler will use to replace the selected text (or the contents of the document).",
on RunFromTextWrangler(myRange)
set myText to myRange as string
set tag to text returned of (display dialog "Insert tag and attributes without < e >" default answer "span class='main'")
set output to "<" & tag & ">" & myText & "</" & first word of tag & ">"
return output
end RunFromTextWrangler
put it in the Text Filters folder and tried it. Did not work with error: "This Apple Event was unknown to the recipient and could not be processed (MacOS Error code: -1708)" which seems to mean "the AppleEvent was not handled by any handler".
Then I changed back to RunFromBBEdit, and IT WORKS!
on RunFromBBEdit(myRange)
set myText to myRange as string
set tag to text returned of (display dialog "Insert tag and attributes without < e >" default answer "span class='main'")
set output to "<" & tag & ">" & myText & "</" & first word of tag & ">"
return output
end RunFromBBEdit
So I assume that the TextWrangler manual was obtained automatically from a similar BBEdit manual, but the handler is RunFromBBEdit anyway. I believe the documentation should be updated.
regards
Fabio