[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference hydra::amiga_v1

Title:AMIGA NOTES
Notice:Join us in the *NEW* conference - HYDRA::AMIGA_V2
Moderator:HYDRA::MOORE
Created:Sat Apr 26 1986
Last Modified:Wed Feb 05 1992
Last Successful Update:Fri Jun 06 1997
Number of topics:5378
Total number of notes:38326

4254.0. "Help with script file" by MLRTYM::TERELLA (MIike Terella , CAD/CAM Technology Center) Fri Nov 09 1990 09:01

	Here's the situation. I've created a script file which, in addition
	to a few other things, runs an application.  This application once
	invoked will prompt the user for input, then do it's thing.  The script
	when executed from CLI works fine.  

	My problem is that I want to trigger this script from an icon.  When
	using ICONX (and I've tried NewEx), the  script works great until the
	call for the application.  The application runs, but it's input prompt
	doesn't show up in the ICONX window.  I know I need to redirect the
	application's output (though I don't know to where), but it gets a 
	little tricky in that the applications resulting output (after 
	receiving user input to the prompt) must also be redirected to a file.  

	The application will take a user input string as a parameter on the
	command line, so that in my script, the following line;

		Application >file.tmp "this is user input"

	will work fine, even when initiated by ICONX.

	Given this, my problem (and real question) now becomes, how does one
	prompt a user for input in a batch run script, capture that input
	as a variable (string), and use that variable in the command line
	for the application.

	The "Ask" function only tests for validity, and doesn't seem able to 
	"store" the response as a variable.  Is there some other function 
	which works like VMS INQUIRE, to which you can assign a variable for
	later use, or is this capability just beyond AmigaDOS?



T.RTitleUserPersonal
Name
DateLines
4254.1inqure.zoo may be what you need...WHAMMY::SPODARYKdigging for fireFri Nov 09 1990 12:1773
This sounds familiar (see 4220.*).  AmigaDOS doesn't support this function
directly, so I wrote a little utility to do so.  It stores the user input
as a environment variable, which can then be expanded with a $env_var.

tape::user2:[upload]inquire.zoo  

inquire.readme

/*
 *  Stephen Spodaryk 		26-Oct-1990 
 *  [email protected]
 *
 *  Purpose:
 *
 *    Short program to perform a basic "inquire" functionality.
 *    The environment variable is set equal to the user's input.
 *
 *    By default, the entered string will have the control characters 
 *    removed, and will trim off trailing blanks.  Some basic punctuation 
 *    is appended to the prompt.
 *
 *  Format:
 *
 *    inquire prompt_string environment_variable [-c -t -p -y | -n]
 *
 *  Options:
 *
 *    -c option will disable space substitution for control characters. 
 *
 *    -t option will disable trimming of trailing blanks.
 *
 *    -p option will disable punctuation on the prompt.  Normally, this
 *       is just a ": ".  When used with -y | -n it becomes " [YES/no]: ",
 *       and " [NO/yes]: " respectively. 
 *
 *    -y option will set the variable to "yes" or "no", based on
 *       the first character of the string entered: N|n = "no", 
 *	 Y|y|no input = "yes".
 *
 *    -n option will set the variable to "no" or "yes", based on
 *       the first character of the string entered: Y|y = "yes", 
 *	 N|n|no input = "no".
 *
 *  Note:
 *
 *    -y and -n are mutually exclusive.  If non YyNn input is given,
 *       a WARN will be returned, and no variable will be set.
 *
 *    Any other parameters are ignored.
 *
 *  Specification:
 *
 *    If the inquiry is aborted, the variable will not be set (unless
 *    you've specified -y or -n, in which case the default will be used)
 *
 *    When the variable is set, "inquire" will return a 0 condition,
 *    and the variable can be used normally.  If the variable is not set, a 
 *    5 (WARN) is set upon exit.
 *
 *    Naturally, you'll need ENV: assigned in order to use the 
 *    environment variables.
 *
 *    See the "example.script" for a useable example.
 *
 *  Disclaimer:
 *
 *    I'll admit that I'm not super knowledgable about AmigaDOS script
 *    files, so if you'd like extra functionality, let me know.  This
 *    started out really small, and kept growing as I thought up new things.
 *
 *    Feel free to add_to/improve it.  Could this be a WB2.0 command?
 *
 */
4254.2Use ARexxDECWET::DAVISYou always get what you deserveFri Nov 09 1990 12:1715
    I just went through the same scenario.  I ended up using ARexx which
    makes the task very simple.(very, very simple)  I suggest getting
    ARexx, it is inexpensive($30US) and makes writing scripts and generally
    controlling your user environment a lot easier.  Here is a description
    of my script:(it took about 6 lines of code in ARexx)
    
    I wanted to start an incremental backup using Quarterback from a pull-down
    menu with a date that I provided.  I use ParM for menus.  ParM opens a
    small CLI window and starts my ARexx script which prompts me for a
    date, when the date is entered CORRECTLY it passes it to Quarterback
    which starts up and does its thing.
    
    Great stuff, that Arexx.  I didn't answer your question, sorry.
    
    md
4254.3Sounds good to meMLRTYM::TERELLAMIike Terella , CAD/CAM Technology CenterFri Nov 09 1990 13:159
	RE .1>  Thanks for the info.  I've copied over inquire.zoo and will
		give it a try.

	RE .2> 	Perhaps it is time I bit the bullet and got ARexx.  I have
		been holding off until Workbench 2.0 is available for the 2000.
		I believe it comes with ARexx.

mt
4254.4Yes, 2.0 comes with ARexx, but...TENAYA::MWMWed Nov 14 1990 16:4316
Yup, 2.0 ships with ARexx - the user half of it. Shared libraries, commands,
and documentation on programming in ARexx.

However, it doesn't have the programmer half of it - header files, link
libraries, and documentation on adding an ARexx interface to your program.

If/when CBM starts providing that information (it's licensed from the author,
and I don't know the details of that license; but ARexx is _not_ the same as
the rest of the system, so they may not), they'll probably charge $20 or more
for it.

So - if you're a programmer - consider that you're putting a $10 investement
into getting an early start with ARexx. I'd recommend it, but I'm biased -
I think ARexx is the best money I've spent on my Amiga.

	<mike