Hello, 

I'm attempting to write an applescript that will automate some keystrokes.

What I want to occur is when I'm inside a tag like so:

<tag>insertion point</tag>

I want to be able to run the script to get the following format:

<tag>

    insertion point

</tag>

This part I have been able to accomplish. But how do I get it to see if the 
tag is indented and if so, keep the insertion point and closing tag indented 
as well? The way it is now it will just do a "\r\t\r" so I end up indenting 
to get it line up correctly but that is what I want the script to accomplish 
for me.

I'm pasting my code below. Any help will be greatly appreciated.

Thanks, Rick


*tell* *application* "BBEdit"

*   set* myInsert *to* "\r\t\r"

*   tell* *front document*

*   set* theSelection *to* (*get* contents *of* selection)

*   set* contents *of* selection *to* myInsert

*      if* theSelection = "" *then*

*         select* *insertion point* *after* *character* ((*count* myInsert) 
- 1) *of* selection

*      else*

*         select* *insertion point* *after* *character* -1 *of* selection

*      end* *if*

*   end* *tell*

*end* *tell*

-- 
You received this message because you are subscribed to the 
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at
<http://groups.google.com/group/bbedit?hl=en>
If you have a feature request or would like to report a problem, 
please email "supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>

Reply via email to