Running a Perl Script from TextPad
TextPad® from Helios Software Solutions has been my text editor of choice for quite a while now, and I have developed many websites and applications using it.
There are plenty of reasons why I like it, but one thing I particularly find useful is the ability to run a command/program from within the editor itself. In this tutorial I'll show you how you can run a Perl script from within TextPad that processes the document that is currently active in TextPad.
Perl and the Perl Script
The first thing you need to do is to identify where Perl is installed on your computer. If it's not installed, then you need to install it. You also need to put the Perl script itself into Perl's 'bin' folder. Typically, the path to perl.exe and the script will be:
Running perl.exe and the Script from TextPad
Next, you need to add perl.exe as a program that can be run from within TextPad, and the Perl script as a parameter. To do this:
1. Select Preferences... from the Configure menu.
2. Click Tools.
3. Click Add and then Program.
4. Browse to, and select, perl.exe.
5. Click Apply. This adds Perl to the list of Tools.
6. Click Perl from under Tools in the left-hand pane. The dialog box will look something like:
7. Edit the settings so that they are typically as shown here:
Note that the name of the script itself needs to be in the Parameters line. In this example, the name of the script is RemoveRedText.pl.
8. Click Tools and then click Perl.
9. Change the name (Perl) to something meaningful, as shown below, and click OK.
Running the Script
To run the script, select it from the Tools menu. It will process the document that is currently active in TextPad.
Here is a sample Perl script that will work for the above setup.
foreach $name (@ARGV)