im trying to figure out how to insert some text at insertion point without using the clipboard but i dont have find any way
anyone can help me?
thanks in advance
some clarifications:
i want insert the text in the application TextWrangler
Here’s one way:
tell application "TextWrangler"
(* code for getting new blank document goes here *)
set text of myDocument to "Now we are engaged in a great civil war."
--> document reads "Now we are engaged in a great civil war."
set insertionString to " bloody"
set after word 6 of text of myDocument to insertionString
--> document reads "Now we are engaged in a bloody great civil war."
end tell
my solution is :
tell application "TextWrangler"
tell window 1
set selection to "<head></head>"
end tell
end tell
and work well, but
how i can move insertion point after the first closing tag?
this work well in TextWrangler:
tell application "TextWrangler"
tell window 1
set selection to "<title> </title>"
select insertion point after character 7 of selection
end tell
end tell
I suspect this is what you really want:
This will add your tag around the selected text (if there is any, if not, it will just put in the open and closing tags and place the cursor between the tags waiting for your to enter something).
Jon
[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]
thanks jhon for this script , it is good for me