Hi,
I am trying to program a macro that will add a 0x to every other character in a text file. Actually it's an XML file but it's the same thing.
so I have text that looks like this
050003d4 00000000 000003c8
54a2 0b33
543e 0007
71e4 0c00
71dc 0000
5002 029c
501c 0f00
502b 0002 0040 0006
503e 0001
5018 fd9a
501f 0006 0000 0001 0100 0002 0080 0000
and would like to make it look like this
0x05, 0x00, 0x03, 0xd4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xc8,
0x54, 0xa2, 0x0b, 0x33,
0x54, 0x3e, 0x00, 0x07,
0x71, 0xe4, 0x0c, 0x00,
0x71, 0xdc, 0x00, 0x00,
0x50, 0x02, 0x02, 0x9c,
0x50, 0x1c, 0x0f, 0x00,
0x50, 0x2b, 0x00, 0x02, 0x00, 0x40, 0x00, 0x06,
0x50, 0x3e, 0x00, 0x01,
0x50, 0x18, 0xfd, 0x9a,
0x50, 0x1f, 0x00, 0x06, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x02, 0x00, 0x80, 0x00, 0x00,
I have created a macro that does that but the file is huge and it's many keyboard presses of ctrl+F12.
#include "slick.sh"
_command add0x() name_info(','VSARG2_MACRO|VSARG2_MARK|VSARG2_REQUIRES_MDI_EDITORCTL)
{
_macro('R',1);
keyin("0x");
cursor_right(2);
keyin(",");
last_event(name2event(' '));c_space();
}
Thank You,
Ed