I've used Textmate since I started hand-coding websites. My boss loves BBEdit. This script allows me to do the thing I missed most from Textmate creating and wrapping tags around text. Enjoy!
- tell application "BBEdit"
- set theText to text of front text document
- set theSelection to the selection as string
- set theCharStart to (characterOffset of selection)
- set theResponse to text returned of (display dialog "Wrap what tags around selection?" default answer "" default button 2)
- set theTag to first word of theResponse
- --set theOther to chars((length of first word of theResponse) - end) of theResponse
- set tmpStr to "<" & theResponse & ">" & theSelection & "</" & theTag & ">"
- set the selection to tmpStr
- set insertionPosition to (theCharStart + (length of tmpStr))
- --select (characters insertionPosition through (insertionPosition - 1)) of front text document
- select insertion point before character insertionPosition of front text document
- end tell
You need to login to post a comment.