Easily automate your editing or conversion tasks using vEdit with the click of the mouse or with a simple batch file.
For example:
vEdit can automate the editing, converting or "cleaning up" of files that you work with on a regular basis. It is one of vEdit's most useful and unique features. You can automate vEdit in many ways. This overview gives simple examples of two particularly useful automation techniques:
vEdit's unique ability to automate the editing of large groups of files is the primary reason that some customers purchase it.
Learn more information about how vEdit can help automate common office tasks such as working on databases and creating e-mail lists.
Automating an editing/conversion task involves using a vEdit "macro". Although vEdit macros can be very elaborate and can often replace complex C or Visual Basic programs, we will illustrate automation with a very simple one-command macro.
For this simple example, we want to strip all trailing "whitespace", i.e. unnecessary spaces and tab characters, from the end of all lines in a text file.
This would be so tedious in a Word Processor that you won't even consider it. If you are a programmer, you might be able to write a non-trivial program to do this.
vEdit can do this with a single search and replace command:
Replace("|W|>","",BEGIN+ALL+NOERR)
vEdit has many invocation options; several allow automatically running macros on startup.
Create a batch file, e.g. "stripw.bat", containing the following command to run vEdit and strip all trailing whitespace from a file:
c:\vedit\vpw -q -e -c'Replace("|W|>","",BEGIN+ALL+NOERR) Xall' %1
This assumes vEdit was installed into the "c:\vedit" directory.
The "-q" option runs vEdit in quiet mode without any screen display; the "Xall" command saves and exits the editor; "%1" is the syntax used in batch files to pass a filename to a program.
The recommended way to do this is to place the vEdit macro commands into a file, typically with a ".vdm" extension. Create a text file, e.g. "stripw.vdm" containing the following vEdit commands:
Replace("|W|>","",BEGIN+ALL+NOERR) //Strip trailing whitespace
Xall //Save file and exit
In this case, place the following command to run vEdit into the batch file:
c:\vedit\vpw -q -x stripw.vdm %1
With the STRIPW.BAT file, you can now easily strip trailing whitespace from a text file. For example, assuming the name of the text file is "payments.txt", at a DOS or NT prompt, simply give the command:
stripw payments.txt
While many users might prefer a batch file, others might prefer a Windows icon. In this case, create a new icon on your desktop, possibly by copying the vEdit icon. Rename the icon to "Strip trailing whitespace". Then right-click on the new icon and select properties. Change the "Command":" or "Target" to the full path name of the batch file created earlier:
c:\batch\stripw.bat
(This assumes you saved the batch file in the "c:\batch" directory.)
Then, you can simply drag and drop a text file from Explorer onto the new icon and all trailing
For this example we want to convert tab characters in a file to just spaces. Many text files contains tab characters; this often makes them difficult to import into other programs, especially if the programs have different tab stops.
This is almost identical to the previous example but a different vEdit macro is needed.
Create a text file, e.g. "detab8.vdm" containing the following vEdit commands:
Config_Tab(8) //Assume tab stops every 8 Detab_Block(0,File_Size) //Convert tabs to spaces Xall //Save file and exit
Then create a batch file, e.g. "detab8.bat" containing the following line:
c:\vedit\vpw -q -x detab8.vdm %1
With the DETAB8.BAT file, you can now easily (detab) convert all tabs characters in a text file to spaces. For example, assuming the name of the text file is "payments.txt", at a DOS or NT prompt, simply give the command:
stripw detab8.txt
As in the previous example, you could also create a Windows icon for this function.
While the automation described above is great for processing a few files, you may need to perform the same edit/conversion operation on hundreds or even thousands of files.
To expand on the first example, now consider that you have a directory of 500 text files that need to have all trailing whitespace removed. vEdit makes this task simple!
You will briefly see the name of each file processed displayed on the screen. With average sized text files, vEdit can process several per second.
For many customers, this "Wildfile" function is vEdit's most important and useful feature. It can save you days of tedious work. We hope you will give it a try.
Although beyond the scope of this overview, the "Wildfile" function can also be fully automated with a batch file or Windows icon.