wrapping selected text with html tags via shortcut

Help with writing and playing macros

wrapping selected text with html tags via shortcut

Postby DoctorO » Wed Feb 09, 2005 5:43 am

Hi,
I am new to UltraEdit and it's macro features. I recently switched from the html editor phase5 which came with a feature to easily wrap selected text with html tags via shortcut. I used that a lot and would like to use it in UE too. E.g. i select a piece of text and then hit alt+enter to wrap it with <p> and </p>.
I know it works by selecting the tag from the taglist. But i dont want to use my mouse for this.
Is there a way to do it via macros?

Thank you
User avatar
DoctorO
Newbie
 
Posts: 2
Joined: Wed Feb 09, 2005 12:00 am

Re: wrapping selected text with html tags via shortcut

Postby oracledba » Fri Feb 11, 2005 3:54 pm

sure.

The easiest way to make any macro is to simply manually do the desired edit operation why you have UE in "record" mode. UE will write macro code for every keystroke (and most mouse clicks) you do. When your done. you stop the record.

you now have working macro code. you can either use it as is or use it as a basis for futher editing. I did such a record.

I started with some text highlighted and then put UE in record mode.
I then did a cut, put in the begin tag, pasted and then typed in the end tag. I then stopped the record. I edited the recorded macro and put an if statement around all of it saying on do this if there is a range highlighted.

Once you have the macro code you can give it a name, and even map it to your desired keyboard shortcut.
here is that code...

IfSel
InsertMode
ColumnModeOff
HexOff
UnixReOff
Cut
"<p>"
Paste
"</p>"
EndIf
User avatar
oracledba
Basic User
Basic User
 
Posts: 24
Joined: Wed Jan 19, 2005 12:00 am

Re: wrapping selected text with html tags via shortcut

Postby DoctorO » Sat Feb 12, 2005 9:11 am

Perfect!

Thank you, that's exactly what I need!
User avatar
DoctorO
Newbie
 
Posts: 2
Joined: Wed Feb 09, 2005 12:00 am


Return to Macros