Hi Chris, Thank you for the reply and the script. It is very useful, indeed. Now I setup a unique keyboard shortcut for the script and choose the wrappers, I got it.
Thanks again, Adrian On Sunday, August 7, 2016 at 1:26:32 AM UTC+3, Christopher Stone wrote: > > On Aug 06, 2016, at 10:01, Adrian Manea <[email protected] > <javascript:>> wrote: > > One of the main things I miss from Sublime Text is the ability to wrap > selected text in symbols/markers or tags. > > ------------------------------ > > Hey Adrian, > > BBEdit is scriptable, which means you can add features to suit yourself. > > This very basic AppleScript will wrap the selected text in whatever text > you provide in the dialog. > > It can be tremendously customized. > > -- > Best Regards, > Chris > > > ------------------------------------------------------------------------------------------- > # Auth: Christopher Stone > # dCre: 2016/08/06 17:00 > # dMod: 2016/08/06 17:10 > # Appl: BBEdit > # Task: Wrap Selected Text in the User-Provided Text. > # Libs: None > # Osax: None > # Tags: @Applescript, @Script, @BBEdit, @Wrap, @Selection > > ------------------------------------------------------------------------------------------- > > *try* > > > *tell* *application* "BBEdit" > *tell* *text* *of* *front* *text document* > *set* selectedText *to* contents *of* selection > *end* *tell* > *end* *tell* > > > *set* wrapperText *to* text returned *of* (*display dialog* "Enter > Wrapper Text" with title "Edit Selection" default answer "") > > > *tell* *application* "BBEdit" > *tell* *text* *of* *front* *text document* > *set* *text* *of* selection *to* wrapperText & selectedText & > wrapperText > *end* *tell* > *end* *tell* > > > *on* *error* e number n > *set* e *to* e & return & return & "Num: " & n > *if* n ≠ -128 *then* > *try* > *tell* *application* (*path to* *frontmost application* as *text*) > *to* *set* ddButton *to* button returned *of* ¬ > (*display dialog* e with title "ERROR!" buttons {"Copy Error > Message", "Cancel", "OK"} ¬ > default button "OK" giving up after 30) > *if* ddButton = "Copy Error Message" *then* *set the clipboard > to* e > *end* *try* > *end* *if* > *end* *try* > > > ------------------------------------------------------------------------------------------- > > > -- This is the BBEdit Talk public discussion group. If you have a feature request or would like to report a problem, please email "[email protected]" rather than posting to the group. Follow @bbedit on Twitter: <http://www.twitter.com/bbedit> --- You received this message because you are subscribed to the Google Groups "BBEdit Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/bbedit.
