Reply To: Removing "boxes" in file

Product Compare Forums Multi-Edit Support Removing "boxes" in file Reply To: Removing "boxes" in file

#5379
deleyd
Participant

Here’s a simple macro that does a search & replace. Change the line which sets g_SearchStr to the letter “t” to your box character. (If you know the hex value of the character you can use “\xHH” where HH is the hex value of the character. Or you can just cut and paste in the box character itself.)

Here we set g_RelaceStr to an empty string so it just removes the character.

[code:1xo30x1z]#include search.sh
/* Globals defined for us in search.sh
str g_SearchStr
str g_ReplaceStr
int g_SearchMode
str g_Switches
str g_ReplSwitches
*/

macro remove_boxchars
{
str save_Switches,
save_ReplSwitches;
int save_SearchMode;

//Save settings
save_Switches = g_Switches;
save_ReplSwitches = g_ReplSwitches;
save_SearchMode = g_SearchMode;

//Set up search & replace
g_SearchStr = "t"; //Search String
g_ReplaceStr = ""; //Replace String
g_SearchMode = 1; //1=search and replace
g_Switches = "CGNX"; //See search.s macro S_And_R
g_ReplSwitches = "CGNX"; //See search.s macro S_And_R
RM("S_and_R"); //Do search and replace
tof; //Move cursor back to top of file

//Restore settings
g_Switches = save_Switches;
g_ReplSwitches = save_ReplSwitches;
g_SearchMode = save_SearchMode;
}
[/code:1xo30x1z]

PreLoad macros are defined for individual file extentions. Go to TOOLS -> CUSTOMIZE -> FILE EXTENTIONS (button), select your file extention, click EDIT, and you should get an “Edit Filename Extention Setup” window. In the lower right is a field “Post-load macro”. Enter “remove_boxchars^remove_boxchars” (without the double quotes).

Load the code into a Multi-Edit window and compile via TOOLS -> EXECUTE COMPILER -> Compile CmacWin Macro. The output should say the filename is remove_boxchars, (and the macro itself is also called remove_boxchars).

Then try it out and see if it works. (There’s more info on compiling CMAC programs under the User Created Macros forum, entries titled “Introduction to CMAC”.)