Home SpamStopsHere EBCDIC Services
Your Account | Shopping Cart | FAQ's | Privacy
Download
Info
Sales
Support

Automation

"VEDIT allowed me to accomplish what seemed to be an impossible job. I needed to change a variable from single precision to double precision -- in hundreds of programs scattered all over the disk (and many times within each program !) VEDIT did the job quickly and perfectly. A great, powerful and indispensable addition to a programmer's tool box. Thanks for a great piece of work."

Len Schneider, Belfast, ME

Automate your editing tasks with VEDIT

With the click of the mouse or with a simple batch file, you can automate many editing or conversion tasks using VEDIT. 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.

Click here for information about how VEDIT can help automate common office tasks such as working on databases and creating e-mail lists.

Automation Example #1 (Strip trailing whitespace)

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. You can 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.)

(Technically, 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.)

A better way of doing this is to place the VEDIT macro commands into a file, typically with a ".vdm" extension. Therefore, 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

(Note that VEDIT macros can be fully commented.) 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

In effect, VEDIT is used here as a utility program. Someone without any knowledge of VEDIT can obviously run the batch file. Best of all, it is fast, VEDIT can start up (invisibly), open the file, strip the trailing whitespace, save the file and exit in about 1 second.

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 pathname 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 whitespace will be stripped from it.

Automation Example #2 (Convert tabs to spaces)

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; 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.

Process Entire Group of Files (Even hundreds of files)

While the automation described above is great for processing a few files, sometimes you 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. Without VEDIT you would be looking at a week or more of very tedious work. (Heck, you might even start looking for another job.)

VEDIT makes this task almost trivially simple. (And you will impress your boss and coworkers with your productivity.)

We will assume that you created the "stripw.vdm" macro file as described in the first example.

  1. Start VEDIT and select the menu item {MISC, Wildfile macro}.
  2. At the "Enter filename:" prompt, enter a file specification, such as "c:\doco\*.txt" which uses the standard wildcard characters "?" and "*" to specify the group of files. E.g. to specify all files in the "c:\doco" directory and in all of its sub-directories, enter "c:\doco\*.* -s".
  3. At the next "Enter filename:" prompt, either enter another file specification, if you need to include more files, or just press <Enter> to continue.
  4. At the "Execute a [C]ommand, [M]acro, [S]earch or [R]eplace:" prompt, press "m" to run a macro.
  5. At the "Enter filename of macro:" prompt, enter "stripw.vdm".
  6. At the "Should -MORE- be enabled?" prompt, press "n".
  7. At the "Press any key to continue..." prompt, press <Enter> and the conversion will start.

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. (So your coffee break while VEDIT does your work should be short.)

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 (already too long) overview, the "Wildfile" function; can also be fully automated with a batch file or Windows icon.

These examples just barely scratch the surface of the many ways in which VEDIT can automate your editing, conversion and file "clean up" operations.

Please Contact Us With Any Sales or Technical Questions:

Mail:
Greenview Data, Inc.
8178 Jackson Road
Suite A
Ann Arbor, MI 48103 USA

E-mail:
or

Telephone (Sales): In US and Canada call Toll-Free 1.800.458.3348

International: 734.426.7500

Fax: 734.426.7510