Find this page online at: http://developers.evrsoft.com/article/web-design/content-webmaster-issues/why-dont-you-build--a-quick-and-dirty-user-interface.shtml

Why Dont You Build A Quick and Dirty User Interface?

By Gunter Gerdenitsch
Posted Monday, September 27, 2004

On your computer, frequently you will have to do a job with several different applications involved. You can not clearly foresee in which order they will be needed, it will be different in each case. Only one thing is for sure: it will have to be done repeatedly, on a number of files.

The conventional way to do that would be to type the same stuff again and again, carefully watching out always to have the right file. That's inefficient, it's tedious, and after a while it is highly error-prone.

At that point, as a seasoned computer-user you will consider to AUTOMATE the whole process. You build yourself a "user interface": At the beginning, the file name is made the default name. Each time before it is processed by an application, the default name is suggested. To accept it, you only need to press the ENTER-key. Otherwise you can simply overwrite it.

Till recently, building such a user interface was not so simple. It required some full-fledged programming. A reasonable investment this was only for a rather long-term requirement. For a one-time use it was just too "heavy".

With 'DLG light', however, now you can do that within a few minutes. Simply write a batch-file combined of a few universal components, strung together by some environment variables.

Generally such a "quick-and-dirty" user interface will be made up of a universal component 'OFFER' whose parameter is the text to be displayed for prompt (or the name of the file holding the text). You just press a key determining the next step of processing. Depending on that key a certain value is returned. By this return value the control is branching out to several processing options. At the end of each processing option the control returns to OFFER - for prompting for the next cycle. As in the following coding scheme.

:next
OFFER "press A - option 1;press B - option 2; ... "
IF ERRORLEVEL 2 GOTO option2
IF ERRORLEVEL 1 GOTO option1
:

:option1
:
application1
:
GOTO next

:option2
:
application2
:
GOTO next

Each processing step starts with another universal component, QUERY. By it the name of the current file is suggested and/or the processing options. They were transferred from another processing step by means of environment variables. If you agree to these defaults, you simply press the ENTER key. As well, you can overwrite it. Then your entry is set to this environment variable. By bracketing the name of the environment variable in %...%, the operating system knows that it should substitute the name of the variable by its current value. [A third parameter might be needed to declare the name of the .bat-file by which the modified value(s) are made effective, if they were overwritten.] Thus the application of a processing step is always provided with the right parameters.

:option_n
QUERY "%file% %options%" envvar_n
IF ERRORLEVEL 1 CALL envvar_n.bat
APPLIC_n %file% %options%
GOTO next

Some Windows-versions (like Windows 95, Windows 98) execute a batch file in asynchronous mode. That is, an executable called by the batch file is launched in a thread of its own, while the batch file itself keeps going on. In such a Windows-version it's better to use another tool, DO:

DO Do.lst ... /b

Do.lst is a plain ascii-file with all the applications you want to have in your user interface, line by line:

application1
application2
:

Note the option /b : Due to it DO is not closed once you select one of the applications but kept in the background. When you are finished with that application and close it, DO appears again, ready for your next selection.

Similarly, there is a number of other universal components available in 'DLG light'. You can download them for free from (http://www.1st-components.com)

By doing so you can see the significant difference between one of the usual components and the "universal components" of '1st Components Design'.

The term "component" is something like a buzzword in the software business, for some 20-30 years now. But when you look closer at those "components", they all have a clear-cut functionality. They either "fit" into your user interface or they don't fit. There is hardly any chance to modify their layout or behavior.

Contrary to that, 1st Components Design developed the concept of "universal" components. Components that have no fixed functionality but behave flexibly, depending on the value of one or more parameters. In 'DLG light' they are given by your command line parameters.

These parameters are represented by the environment variables bracketed in %...% that are written in the same line following the name of the component (OFFER, QUERY, etc.)

A "quick-and-dirty" user interface is not such a minor thing. We use it ourselves for all our installation procedures. Many little procedures that are typically used only once, so a full-fledged programming (with top performance, etc.) would not be reasonable. What's much more economical here is a highly versatile construction from a few components. Thus we can build an installation within a few minutes, to a clear outcome.

By a 'quick-and-dirty' user interface you can combine individual tools to an integrated "work bench". Any number of tools, any kind of tools, any "work bench". Tailor-made to your needs. Your imaginativeness is the only limit.

Why is it called "quick-and-dirty" user interface? Well, the "quick" will be clear by now. "Dirty" it is in terms of its performance and user friendliness - which are far from optimum, of course. If you want to build a good, "clean" user interface, you should consider using our full DLG product line.

About theAuthor
Article by Gunter Gerdenitsch, owner of '1st Components Design', Universal Software Components for Computer Applications without Programming ( (http://www.1st-components.com), mailto:gunter@1st-components.com ). He is the specialist for the everyday use of the computer.