UltraEdit macros are not Visual Basic scripts. You can't access Windows environment variables from within an UltraEdit macro. All macro commands are listed in the macro editor or on UltraEdit help page
Edit Macro command. That's it, that's all you have.
There is only one command which gives you the possibility to access something outside UltraEdit, the command
RunTool to call one of the 25 user or 25 project tools by name. But that user tool must be configured first from the Advanced menu.
See
How to run ANY console or Windows application from within an UE script/macro? for a general solution to call the command
echo %username% from within a macro.
Or you configure a user tool just for getting the user name as follows:
On tab
Command:
Menu Item Name:
Get User Name (for example)Command Line:
echo %username%Working Directory:
(let it empty)Toolbar bitmap/icon:
(let it empty or browse to a BMP or ICO file)On tab
Options:
Program Type:
Dos ProgramSave Active File:
uncheckedSave all files first:
uncheckedOn tab
Output:
Command Output:
Output to List BoxShow DOS Box:
uncheckedCapture Output:
checkedReplace selected text with:
Captured OutputWith that user tool the macro could position the cursor in the active file where the user name should be inserted and then use the command
RunTool "Get User Name"