User to user discussion and support for UltraEdit, UEStudio, UltraCompare, and other IDM applications.

Help with writing and playing macros
4 posts Page 1 of 1
In UltraEdit v15 I can create macro to type the character (0xD9 in MS line draw) in attachment.
After updated to currently latest version, I cannot use that macro to type this character.
I try to type Alt+ "217" or Alt + "0217", it shows "?" instead of character in attachment.
Please recommend me to solve it.


I can type Alt+217 directly to editor and it show correct character.
However I want to use it in macro to create table.


Your question cannot be really answered without knowing which text encoding you use for the text files the macro should insert characters from the box drawing character set.

By reading your posts I have the impression that you do not really know much about text encoding. Therefore I suggest that you first read the brief overview about text encoding in power tip Working with Unicode in UltraEdit/UEStudio and read also the two referenced articles written by Tim Bray and Joel Spolksy.

After reading those articles, you should know that there are mainly 2 types of text files:

  1. Text files using 1 byte per character which limits the number of characters being used in the text file to 256 characters in total. The code page used by author of text file AND by the readers of text files determines how such text files are displayed to the human being. For the computer a text file is just a series of 0's and 1's like the contents of any other file.

  2. Text files using more than 1 byte per character which makes it possible (in theory) to encode any character in same text file. Very common are for such text files UTF-16 Little Endian with Byte Order Mark (BOM) and UTF-8 without BOM.
Text files contains just the bytes for the characters with the exception of the bytes for byte order mark in case of using a Unicode text encoding with BOM. How those bytes appear on screen is based on an agreement made between the author of the text file (you), the application used by the author (UltraEdit in your case), the text encoding/code page selected by author of text file, the applications used by the readers of the text file and last by the readers as they control which application they use for viewing the text file and with which settings.

So you can set in advance that the text file uses just 1 byte per character and for viewing the text file the readers have to use the font MS Line Draw. In this case the macro has to write into the text file a byte with hexadecimal value D9 independent on which font and code page/encoding is currently used for the text file in UltraEdit and in the edit macro dialog. Too bad if a reader has MS Line Draw not installed like me or all Linux/Mac users.

Therefore I think you want a text file which does not force your readers to use a specific font.

But in this case you have to make the decision for using a single byte encode text file or a Unicode text file.

I suppose you want to insert those line drawing characters into a single byte encoded text file like a *.nfo file which is output usually in a console window on Windows. Console windows use OEM code pages on Windows. But which code page is used in the console window on Windows depends on the Windows region and language settings of the Windows user. In North America (US, Canada) the code page OEM 437 is used, in Western European countries OEM 850 and in Russia most likely OEM 866. If you want to know which code page is by default active on your computer, open a command prompt window and type chcp (change code page command without any parameter).

The OEM code pages have in common that those box drawing characters existing in all of the OEM code pages have the same code point value. So character BOX DRAWING LIGHT UP and LEFT with Unicode code point value U+2518 (hexadecimal value 2518 in UTF-16, decimal 9496) must be encoded in text files being displayed with an OEM code page with hexadecimal value D9 which is same value as in font MS Line Draw which of course is no accident.

Now let me assume you are using a font like Terminal or really MS Line Draw for displaying text in UltraEdit which are OEM fonts although the code page set for active file is Windows-1252. Those fonts don't support the ANSI code pages. So you have to insert for a byte with value D9 which can be done by pressing and holding left Alt key and typing quickly on numeric key pad with numeric function enabled 0217. This inserts the character Ù as this character has in code page 1252 the decimal code value 0217, but you get nevertheless displayed because of the used font.

It is of course possible to record inserting of this character into a macro. Opening the recorded macro results in displaying the commands

Code: Select all

The font and the code page in the edit macro dialog is of course not the same as you set for the file. Code page and font is defined in the Windows settings. Therefore you see the character now with the code page for Windows GUI application depending on language set in Windows region and language settings.

Now you know enough about text encoding and can therefore create the macros. I suggest you open in your browser the Wikipedia page about Windows-1252 code page and additionally the Wikipedia page about OEM 850 or whatever code pages are more suitable according to your language settings and create the macros by copying/pasting the characters from the Windows code page into the edit macro dialog (or a text file later copied into the edit macro dialog) which fits to the box drawing character you finally want in your text file output in a console window with an OEM code page.

Two more hints:

There are the commands ANSI to OEM and OEM to ANSI in submenu Conversions of main menu File and context menu of a file tab.

And it is possible to configure to view and edit specified file types like *.bat and *.nfo with a different font (an OEM font) and/or using automatically ANSI to OEM conversion for every inserted character, see Different font depending on file extension. I use for files with extension BAT the true type font Courier New (instead of bitmap font Dina) with font size 12 (instead of 10) and with OEM Character Set by default enabled to convert automatically all special German characters on typing from ANSI to OEM for batch files.
Best regards from Austria
Thanks for your recommendation.
FYI, I set code page to 874 ANSI/OEM-Thai which is defined it by the windows setting.
And you're right, I would like to insert it in a single byte encoded text file.

Now I found the solution.
Just type macro in hex mode on. Now it works.

Code: Select all
4 posts Page 1 of 1