To make the process even more streamline, I wrote a macro that inserts double square brackets and then puts the cursor in the middle of them. And then if you run the macro again, it identifies that the cursor is in front of the closing brackets and pops the cursor to the end and adds a space.
So I can hit the keyboard short cut and instantly have the cursor between [[and]] and then I hit the short cut again [[and]] I'm here. When I'm done writing I run the convert to comments macro and all is good.
My macro also identifies if you've highlighted text and puts [[around highlighted text]] as well.
To make this work I used some code that was written by Kino in another post that moved the cursor left and right. Thanks Kino.
Code: Select all
$value = Read Selection IF $value Type Text "[[$value]]" else $text = "" $sel = TextSelection.active # if you have not reached the end of the text object... if $sel.bound < $sel.text.length $posRight = Range.new $sel.bound, 2 TextSelection.setActiveRange $posRight $text = Read Selection end if $text == "]]" Select End Type Text " " Else $origloc = Range.new $sel.location, 0 TextSelection.setActiveRange $origloc Type Text "[]" # move two characters left $sel = TextSelection.active if $sel.location > 0 # if you are not in the very beginning of the text object... $posLeft = Range.new $sel.location - 2, 0 TextSelection.setActiveRange $posLeft end end END