Macro for Text Prefix and Suffix in HTML :PSPAD Tutorial

Some times its very annoying to go to every html file and make changes to it .

Hence Macro came in action , PSPAD is excellent tool  for Code editing. (But i would recommend Notepad++ by my self)

PSPAD has a great feature called Macros, You can record them or even Type to code them.

Now Problem: Problem is to add Prefix and Suffix to any selected Text

 

PSPAD Prefix Macro
PSPAD Prefix Macro

Example

Our Text is here , You may want to add some Prefix/Suffix or Tags before and after it.

So it may look like

functionx(“Our Text is here , You may want to add”)

or /”Our Text is here , You may want to add“anytext here

or anytexthereOur Text is here , You may want to addanytexthere

 

To do this

Goto PSPAD>Tools>Macro>Start Stop Recording

Now Repeat the process

Goto PSPAD>Tools>Macro>Start Stop Recording

 

Now PSPAD will ask you to save it via a Name

save it with say “PrefixSuffix”

Now goto

Goto PSPAD>Tools>Macro>Macro Manager

and Select Your PrefixSuffix Macro

Edit it

and Paste Following Code there

ecCopy
ecChar{You can Type any Prefix here Between Curly braces}
ecPaste
ecChar{You can Type any suffix here Between Curly braces}

You can now Give a shortcut to it . Say Like F5

 

So now when ever you select a text and press F5 , This macro is going to work

Another technique is to Create a file with extension .pme

Save Macro in it and copy file to following location(For windows 7)

c:\users\yourname\AppData\Roaming\PSpad\Macro\macroname.pme

Here are some popular PSPAD commands.

Macro commands

File Format

Each command requires a separate line. After character writing command, ecChar places desired character in {} curly braces. For example, the command ecChar{Hello} will output at current cursor position the word “Hello”.

List of Commands

Command Description
ecLeft Move cursor left one char.
ecRight Move cursor right one char.
ecUp Move cursor up one line.
ecDown Move cursor down one line.
ecWordLeft Move cursor left one word.
ecWordRight Move cursor right one word.
ecLineStart Move cursor to beginning of line.
ecLineEnd Move cursor to end of line.
ecPageUp Move cursor up one page.
ecPageDown Move cursor down one page.
ecPageLeft Move cursor right one page.
ecPageRight Move cursor left one page.
ecPageTop Move cursor to top of page.
ecPageBottom Move cursor to bottom of page.
ecEditorTop Move cursor to absolute beginning.
ecEditorBottom Move cursor to absolute end.
ecGotoXY Move cursor to specific coordinates.
ecNextLineStart Move cursor to next line begining.
ecSelLeft ecLeft + ecSelection
ecSelRight ecRight + ecSelection
ecSelUp ecUp + ecSelection
ecSelDown ecDown + ecSelection
ecSelWordLeft ecWordLeft + ecSelection
ecSelWordRight ecWordRight + ecSelection
ecSelLineStart ecLineStart + ecSelection
ecSelLineEnd ecLineEnd + ecSelection
ecSelPageUp ecPageUp + ecSelection
ecSelPageDown ecPageDown + ecSelection
ecSelPageLeft ecPageLeft + ecSelection
ecSelPageRight ecPageRight + ecSelection
ecSelPageTop ecPageTop + ecSelection
ecSelPageBottom ecPageBottom + ecSelection
ecSelEditorTop ecEditorTop + ecSelection
ecSelEditorBottom ecEditorBottom + ecSelection
ecSelectAll Select entire content of editor, cursor to end.
ecCopy Copy selection to clipboard.
ecScrollUp Scroll up one line leaving cursor position unchanged.
ecScrollDown Scroll down one line leaving cursor position unchanged.
ecScrollLeft Scroll left one char leaving cursor position unchanged.
ecScrollRight Scroll right one char leaving cursor position unchanged.
ecInsertMode Set insert mode.
ecOverwriteMode Set overwrite mode.
ecToggleMode Toggle ins/ovr mode.
ecNormalSelect Normal selection mode.
ecColumnSelect Column selection mode.
ecLineSelect Line selection mode.
ecMatchBracket Go to matching bracket.
ecGotoMarker0 Goto marker 0.
ecGotoMarker1 Goto marker 1.
ecGotoMarker2 Goto marker 2.
ecGotoMarker3 Goto marker 3.
ecGotoMarker4 Goto marker 4.
ecGotoMarker5 Goto marker 5.
ecGotoMarker6 Goto marker 6.
ecGotoMarker7 Goto marker 7.
ecGotoMarker8 Goto marker 8.
ecGotoMarker9 Goto marker 9.
ecSetMarker0 Set marker, 0.
ecSetMarker1 Set marker, 1.
ecSetMarker2 Set marker, 2.
ecSetMarker3 Set marker, 3.
ecSetMarker4 Set marker, 4.
ecSetMarker5 Set marker, 5.
ecSetMarker6 Set marker, 6.
ecSetMarker7 Set marker, 7.
ecSetMarker8 Set marker, 8.
ecSetMarker9 Set marker, 9.
ecDeleteLastChar Delete last char (i.e. backspace key).
ecDeleteChar Delete char at cursor (i.e. delete key).
ecDeleteWord Delete from cursor to end of word.
ecDeleteLastWord Delete from cursor to start of word.
ecDeleteBOL Delete from cursor to beginning of line.
ecDeleteEOL Delete from cursor to end of line.
ecDeleteLine Delete current line.
ecClearAll Delete everything.
ecLineBreak Break line at current position, move caret to new line.
ecInsertLine Break line at current position, leave caret.
ecImeStr Insert character(s) from IME.
ecUndo Perform undo if available.
ecRedo Perform redo if available.
ecCut Cut selection to clipboard.
ecPaste Paste clipboard to current position.
ecBlockIndent Indent selection.
ecBlockUnindent Unindent selection.
ecTab Tab key.
ecShiftTab Shift+Tab key.
ecUpperCase Convert to uppercase. Apply to the current or previous word.
ecLowerCase Convert to lowercase. Apply to the current or previous word.
ecToggleCase Toggle case. Apply to the current or previous word.
ecTitleCase Convert to title case. Apply to the current or previous word.
ecUpperCaseBlock Convert to uppercase. Apply to current selection, or current char if no selection is made.
ecLowerCaseBlock Convert to lowercase. Apply to current selection, or current char if no selection is made.
ecToggleCaseBlock Toggle case. Apply to current selection, or current char if no selection is made.
Macro for Text Prefix and Suffix in HTML :PSPAD Tutorial
Tagged on:                 

One thought on “Macro for Text Prefix and Suffix in HTML :PSPAD Tutorial

  • February 12, 2012 at 10:03 am
    Permalink

    Great !! I just wrote my own macro for adding custom expressions using your tut. Very simple now .Thanks

    Reply

Leave a Reply

Your email address will not be published.