vEdit Macros and Automation

Perform repetitive and complex tasks easily

In addition to its visual editor, vEdit has a powerful macro language that lets you perform file editing, conversion and other tasks. Execute macro commands and complex scripts from the interface or from Windows. vEdit also includes an extensive macro library that extends its capabilites. You can write your own macros to go even further.

Macro Commands Perform Hundreds of File Operations

vEdit's macro language includes over 400 commands that let you perform file operations like viewing, editing and more. The commands are easy to use and you can execute them from the Windows Command Prompt or vEdit's COMMAND MODE prompt.

Windows Command Prompt

You can execute macro commands from the Windows Command Prompt. For example, to open the file named "file.txt" at line 1,058, enter:

C:\Users\Public\Documents>vpw -c 'goto_line(1058)' file.txt

vEdit Command Mode

vEdit's interactive "Command Mode" lets you execute macro commands from within the editor. Simply enter any sequence of commands at the "COMMAND:" prompt. Each one executes when you press <Enter> and you can see the changes to your file immediately. You can even "undo".

More about Macro Commands (vEdit wiki)

vEdit's Command Prompt lets you execute individual macro commands
vEdit's Command Prompt lets you execute individual macro commands

Programming vEditFor Automating Complex and Repetitive Tasks

To process one or more files interactively or in batch mode, you can save sequences of commands in script files (called "Command Macros" or just "Macros"). You can run macros by assigning them to hot keys or the User menu, or by calling them from vEdit's Command Mode window, the Windows Command Line or even a Visual Basic script!

vEdit's macro programming language includes not only the Macro commands (above) but also structures for sophisticated tasks. These include:

  • Conditional ("if-then-else") statements
  • Flow Control ("repeat", "while", "for", etc.) statements
  • Block Operations
  • Registers for storing and retrieving text
  • Trace Mode for debugging

Macro Language Manual (PDF)

#100=Zoom_Status		// Save zoom state
if (!#100) {			// If not currently zoomed then zoom now
Win_Zoom()
}
#101=Win_Color			//Save current text attribute
Win_Clear()			//Clear window, home cursor
#102=0				//Clear attribute counter register
Repeat(128) {			//Loop 128 times
    Win_Color(#102)		//Set attribute with counter value
    Num_Type(#102,NOCR)		//Display attribute value
    #102++			//Increment attribute counter
    if (#102%8==0) {		//Every 8 colors, start a new line
	Type_Newline()
    }
}
Win_Color(#101)			//Restore original attribute
#101=Get_Num("\nEnter value of desired color: ")
				//Prompt for new value
Win_Color(#101,#101,EXTRA)  	//Set new color; also as "configured" color
if (!#100) {			//If window was not zoomed then de-zoom it
    Win_Zoom(CLEAR)
}
Update()			//Force screen update
Part of a vEdit Script using the Macro Language

Built-In and Custom Macros Extend vEdit's Functionality

vEdit comes with over a hundred built-in macros that perform a variety of tasks, from simple to complex. Macro functions include HTML editing, file operations and conversion, email address extraction, programming assistance, graphics, database and EBCDIC/COBOL operations, and more.

Many built-in macros are available from vEdit menus and all can be executed from vEdit's Command Mode window and the Windows Command Line. For example to compare two files from the Windows Command Prompt:

C:\Users\Public\Documents>vpw -x compare file1.txt file2.txt

Extend vEdit's functionality even further by creating your own macros using the macro commands and language. Refer to our extensive documentation and the built-in macors to help you write your own.

Macro Language Manual (PDF)

Just a Few of vEdit's Over 100 Built-In Macros

File Operations

  • compare: Compare two files
  • compdir: Compare all the files in two directories

File Conversion

  • b64-in: Decode base64 text, files, etc.
  • b64-out: Encode text, files, etc to base64

Email Addresses

  • e-email: Extract all "From:" and "Reply-to:" e-mail addresses from an email archive file, sort them and remove duplicates. Works well with Eudora .MBX files
  • e-xtract: Extract all e-mail addresses from a file, sort them and remove duplicates.

EBCDIC / COBOL

  • cobol2v: Convert a COBOL copybook to a special vEdit format.
  • ebcdic-t: EBCDIC Level-2 Trial version (limited to 5000 fields)