« April 2007 | Main | June 2007 »

May 01, 2007

How to Use Line Processor to Save Time on Repetitive Tasks

I often find myself needing to build a series of commands or statements from a list of elements. Whether I am linking a list of emails, building an SQL insert statement or writing a block of field validation code, this Line Processor makes the job very easy. Here's how to use this simple yet powerful tool.

I will walk through some of the steps for building a short web form, however the List Processor can be applied to any number of things not programming related. The form in this example will take a name, email and 5 URLs.

The Line Processor Interface
First, let's look at the tool itself. There are three sections:

  1. the List of core items,
  2. the Mask that will be applied to each item,
  3. and the Results of the processing.

The mask section has an additional save to button feature which I will cover later.

The List
The list of items contains each element I want to do something with. For my example, I have a list of field names that I'll be creating as HTML entities for the web page form.

name
email
url1
url2
url3
url4
url5

(Line Processor could even help create the list sequence url1..url5 but with such a short list I just typed them.)

The Mask
I now specify what I want to do with the list. For the example, I am creating HTML code, so the mask is:

<input type="text" name="{{LINE}}" id="{{LINE}}" value="" />

Clicking the Go! button will then make a copy of the mask for each line in the list and put the list element in wherever "{{LINE}}" appears.

This produces the following:

<input type="text" name="name" id="name" value="" />
<input type="text" name="email" id="email" value="" />
<input type="text" name="url1" id="url1" value="" />
<input type="text" name="url2" id="url2" value="" />
<input type="text" name="url3" id="url3" value="" />
<input type="text" name="url4" id="url4" value="" />
<input type="text" name="url5" id="url5" value="" />

Save a Mask to a Button
I'm now going to temporarily save this mask to a button via Save mask to button. I stress temporary because the new button created will disappear when I leave the Line Processor page or close the browser window.

The mask is now saved to a button so that I can recall the mask as saved after making changes to the mask. This is perfect for creating several masks before I have my list the way I want it. For example, I create this next mask to use in the processing of the form:

validateNotEmpty($_POST['{{LINE}}'], '{{LINE}} cannot be blank.');

I save this mask to a button and can break name into first_name and last_name and just recall and apply each of the masks I had saved.

In Conclusion
Manually editing repetitively is tedious, boring and prone to erorrs and search and replace can only go so far. This is especially true when working with a changing list of items. The Line Processor really makes batch modifications to a long set of items easy--especially when combined with another great tool, the Online Clipboard.

Posted at 01:29 PM | Web Site Stuff | Comments (1)