[comp.os.msdos.apps] 123 Getlabel macro question

ccastdf@prism.gatech.EDU (Dave) (02/28/91)

    I want to use the GETLABEL and GETNUMBER macro commands to issue a
variable prompt and perform input. The example below is a macro subroutine
INPSUB for input, which uses the contents of PROMPT as a prompt string, and
returns the user input in CURINPUT.
 
Defined Ranges -------------PROMPT CURINPUT NAME ADDR
 
Macro Steps -----------
                        :
                {let PROMPT,"Enter your name: "}
                {INPSUB}
                {let NAME,CURINPUT}
                {let PROMPT,"Enter your address: "}
                {INPSUB}
                {let ADDR,CURINPUT}
                        :
 
{INPSUB}        {getlabel PROMPT,CURINPUT}
                return
 
    This seems to work in V2.2, but not V2.01.  Should this work in V2.01? 
Am I doing something wrong?  Is there some otheacro what v1-2-3 is running?
 
Please reply by e-mail or post..


Dave
-- 
David Frascone 				ccastdf@prism.gatech.edu
Georgia Institute of Technology,
Atlanta Georgia, 30332
Office of Information Technology--User Assistant

rlarson2@uxh.cso.uiuc.edu (Robert S larson) (03/01/91)

ccastdf@prism.gatech.EDU (Dave) writes:


>    I want to use the GETLABEL and GETNUMBER macro commands to issue a
>variable prompt and perform input. The example below is a macro subroutine
>INPSUB for input, which uses the contents of PROMPT as a prompt string, and
>returns the user input in CURINPUT.
> 
>Defined Ranges -------------PROMPT CURINPUT NAME ADDR
> 
>Macro Steps -----------
>                        :
>                {let PROMPT,"Enter your name: "}
>                {INPSUB}
>                {let NAME,CURINPUT}
>                {let PROMPT,"Enter your address: "}
>                {INPSUB}
>                {let ADDR,CURINPUT}
>                        :
> 
>{INPSUB}        {getlabel PROMPT,CURINPUT}
>                return
> 
>    This seems to work in V2.2, but not V2.01.  Should this work in V2.01? 

In V2.01 the first argument of {GETLABEL   } can only be a string -- whereas
in V2.2 it can be a string, a string formula, or a range.

A method which works in both versions and only requires one additional line
is to include a macro step which alters the {GETLABEL  }.  Just change your
sub-routine {INPSUB} to this:

{INPSUB}  {let INPSUB2, +"{getlabel "&@char(34)&prompt&@char(34)&",curinpt":v}
{INPSUB2} this cell is created by the cell above it, it is the getlabel comm
           {return}

The macro at cell {inpusub} not creates the proper {getlabel  } in  the
cell just below it -- which is now named INPSUB2.
The purpose of the @char(34) in the string formula is to put the proper
"" in the prompt
s
D
C
cell just below it, which is now called {INPSUB@}
	  {return}