home *** CD-ROM | disk | FTP | other *** search
- ***************************************************************
- Easy String Requester - ESR V1.00
- By Scott Ellis
- (sellis@steer.sdsu.edu)
- ***************************************************************
-
- What it Does:
-
- ESR allows you to bring up a string gadget from a script or a command line,
- and return the value input to the requester to stdio (the shell or script).
-
- What it Needs:
-
- ReqTools library, and Kickstart 2.0 or higher.
-
- Why it's Here:
-
- I needed such a program for use with ToolManager 2.0, to make a few entries
- easier on myself. I also never used ReadArgs() before, and wanted to play
- with it. ;-) Heck, someone else might find it useful too.
-
- How to Use It:
-
- Typing "ESR ?" brings up the usual command template. Isn't the Amiga
- wonderful! You should get the template:
-
- BUFFER/A,TITLEBAR/A,MESSAGE/K:
-
- BUFFER What the default entry should be in the string gadget.
- If the user just presses RETURN, or clicks on OK, then this
- value will be returned.
-
- TITLEBAR What the titlebar of the window should say!
-
- MESSAGE ReqTools is very cool, and allows you to write a little
- message above the string gadget. This is really useful
- if you need to include more text than will fit in the
- titlebar, or if you want the text to be noticed. I
- don't know about you, but I hardly ever pay attention to
- window titlebars. ;-)
-
- If the user enters a valid string, presses RETURN, or clicks on OK, then it
- returns with ReturnCode of 0. If CANCEL was selected, then the ReturnCode
- is set to 5. Makes it a lot easier to use in scripts.
-
- What to do with It:
-
- Whatever you want! My use for it was for use with networking software, and
- a few scripts I wrote for it. With ToolManager 2.0 and ESR, it was trivial
- to make a decent interface for the AS225 software. For example, to open
- an FTP connection, ToolManager calls FTP with the argument as the result of
- ESR. This way all I do is type a hostname, and a connection is made. Much
- more Amiga-ish than opening a shell first.
-
- ftp `ESR "amiga.physik.unizh.ch" "Enter Destination" MESSAGE "Type something"`
-
-
- That's it!
-
- ***
- *Note: It seems that quite a few people don't read manuals, and so miss out
- *on a very nice AmigaDOS feature. Backquotes (`) allow programs to be executed,
- *and their result sent to the calling program. For example:
- *
- * Assign Foo: `ESR "Ram:" "Where is Foo:?"`
- *
- *This will allow the user to type in where he would like Foo: assigned, and
- *the result from ESR (Default is RAM: in this case) would be returned to the
- *assign command, so assign would "see" 'Assign Foo: Ram:'.
- ***
-
- AmigaDOS 2.0 also allows you to give environment variables as arguments, so
- lets pretend that I usually have a variable set called MYNAME, and that
- USUALLY MYNAME is "fred". Well, you can have ESR use MYNAME as the default,
- so if MYNAME is the name you want, just press RETURN, or click on OK.
- Here's an example:
-
- setenv CURRENTNAME `ESR $MYNAME "Enter a name:"`
-
- This will set the variable CURRENTNAME to whatever is entered in the ESR
- gadget. Make sense? Of course it does! :-)
-
- Anyhow, the program is useful, but simple. If you use it, great, if not,
- delete it. No skin off my back. ;-) If you want the source, drop me some
- E-mail, and I'll mail it to you...it's only about 1k.
-
- ESR is also pure, so you can set the pure bit (Protect ESR +P), and make it
- resident if you wish. No biggie.
-
-
- Scott Ellis
- sellis@steer.sdsu.edu
- Jan 1993
-
-
-