Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- FUNCky - Norton Guide http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]

Input commands:     You can get input from the user by using
                    another '@'  (at) command. The @ command
                    you will  use is  called @ASK.  The @ask
                    command  displays  a  prompt,  and  then
                    waits for  input from  the user. You can
                    assign a  number to  the users  response
                    that can  be used  later in the building
                    of DOS commands. The format for the @ask
                    commands is as follows:

                         @ASK 'PROMPT' #NUM {LENGTH}

@ask command:       The  @ask  command  must  be  the  first
                    command  on   the  line.   The  commands
                    following the  @ask can  be anywhere  on
                    the line  and in  any order. The example
                    shown  is  the  recommended  usage.  The
                    break down is as follows:

                         @ASK      -  directs dMENU to get input from user
                         'PROMPT'  -  is the text @ask will display
                         #NUM      -  is the number assigned to users input
                         {LENGTH}  -  is the optional length of the field
                                      that user will be presented to fill

Using the input:    Once you  have requested  input from the
                    user. The  number you  have assigned for
                    that response  can be  used in later DOS
                    commands  as  a  replaceable  parameter.
                    This  works   similiar  to   the  %1  %2
                    parameters available  to batch files. To
                    insert the  users response  into  a  DOS
                    command requires  that you  include  the
                    number that  you assigned  surrounded by
                    left and  right brackets  '[]'. A simple
                    example would be to copy a file from one
                    place to  another. If  you wanted to add
                    an option  to a menu to copy files, your
                    DOS commands could look like:

                         @ask 'Copy Which file? ' #1 {25}
                         @ask 'Copy to Where? ' #2 {25}
                         copy [1] [2]

                    In this  example, when  the user selects
                    the menu  item that  corresponds to  the
                    commands  in  the  example,  the  prompt
                    Which file  to copy?  will appear on the
                    bottom line  of the  screen.  A  reverse
                    highlighted  field   will  be  displayed
                    after the  prompt awaiting  user  input.
                    The user  can fill  in the  filename  to
                    copy  and   press  return.   Since   the
                    assignment #1  appears  after  the  @ask
                    command, the  users response  from  this
                    @ask command  can always  be referred to
                    as [1]  in following  DOS command lines.
                    Once the user presses return, the second
                    @ask  command   will  be  executed.  The
                    prompt Copy  to Where? will be displayed
                    on  the   bottom  line   of  the  screen
                    followed by a reverse video field. Since
                    the  second   @ask   command   has   the
                    assignment #2  in it, the users response
                    to  this  @ask  command  can  always  be
                    referred to as [2].

                    When the  user presses  return after the
                    second  @ask   command,  the  third  DOS
                    command  is   executed.  Since  the  DOS
                    command copy  [1] [2] contains a pair of
                    brackets, dMENU  scans the  command  for
                    the number  assignments in  between  the
                    two brackets and then replaces them with
                    the users  input  associated  with  that
                    number. So  in our  example, if the user
                    typed  A:dMENU.TXT  in  reponse  to  the
                    first prompt,  and B: in response to the
                    second  prompt,   then  the   third  DOS
                    command will expand to:

                         COPY DMENU.TXT B:.

{Length} command:   Another optional  command  available  to
                    you is  the {LENGTH}  operator.  If  you
                    place a  number in  curly brackets after
                    your @ask  command, then  that number is
                    used as  the length of the reverse video
                    input field  presented after  the prompt
                    on the  bottom line  of the screen. Keep
                    in mind  that this length depends on the
                    length  of   the  prompt  that  you  are
                    displaying. The maximum length you could
                    specify is  78 characters  long. If  you
                    specify a  length greater  than will fit
                    after the  prompt,  then  the  field  is
                    shortened to  the maximum length allowed
                    on that  line. If  no  number  in  curly
                    brackets is  found, then  dMENU uses the
                    maximum length  it can  fit  after  your
                    prompt.

Example:            A good  example for  the {length} option
                    would be  to use the chkdsk (check disk)
                    command to  perform a check of a certain
                    drive. There  is no need to have a field
                    of 40  characters if  all you  need is a
                    drive letter.  You could therefore limit
                    the user  to a  maximum of one character
                    with the following syntax:

                         @ask 'Drive to check? ' #1 {1}
                         chkdsk [1]:\
                         pause

                    When   the   first   @ask   command   is
                    encountered,  the   user  will  only  be
                    allowed  to  enter  one  character.  The
                    following  commands   adds   the   users
                    response and  then appends a colon after
                    the drive  specifier. The  pause command
                    ensures that  the user will have time to
                    read the results of the chkdsk.

                    You  can   also  use   the   replaceable
                    parameters inside  an  @ask  prompt.  An
                    enhancement of the copying example given
                    previously   can   include   the   users
                    response from  the  first  @ask  command
                    inside the second prompt, like this:

                         @ask 'File to copy? ' #1
                         @ask 'Copy [1] to Where? ' #2
                         copy [1] [2]

                    This example will take the users
                    response from DOS command number 1 and
                    insert it into the prompt for DOS
                    command number 2.

Cautions:           When working with replaceable parameters
                    there are  certain rules  that  must  be
                    followed. If  improper syntax, or values
                    out of  range are  used, then dMENU will
                    take  certain   actions.  The  following
                    lists rules, and default values.

                    The @ask command must be the first thing
                    on  the   line.  All   prompts  must  be
                    enclosed inside  single  quotes. If your
                    @ask command  is missing  a quote in the
                    prompt field,  then the  prompt  becomes
                    blank. All  @ask commands  are  executed
                    before any  DOS commands  are run.  Make
                    sure that  you @ask for input before you
                    use it  in a DOS command. You should not
                    use [1]  as a  replaceable parameter  if
                    you have  not done  an @ask  'prompt' #1
                    first. If  you do,  then  the  [1]  will
                    expand to  nothing. If  no  #num  number

                    assignment is  present within  the  @ask
                    command, then  you cannot  reference the
                    input associated  with that @ask command
                    even though  a reverse  video  field  is
                    presented to  the  user.  If  the  field
                    length specifier  {length} is  missing a
                    curly bracket,  or the  length specified
                    is 0,  or greater  than  the  amount  of
                    space left  after the  prompt, then  the
                    length of  the reverse  video field will
                    be the  maximum  length  that  will  fit
                    after the prompt.

                    If you make a reference in a DOS command
                    to user  input that has not been defined
                    yet, then that reference will default to
                    a null  string (nothing).  For  example,
                    COPY [4954]  B: will be expanded to COPY
                    B: since  no references  to  user  input
                    #4954 were  ever made.  When assigning a
                    reference number  to user  input you are
                    not supposed  to assign a number greater
                    than the  maximum number of DOS commands
                    allowed.  The   default  number  of  DOS
                    commands allowed  is 15. So you can have
                    a  maximum  of  15  @ask  commands,  and
                    therefore, you cannot reference any user
                    input  greater   than  [15].   You   can
                    increase  the  number  of  DOS  commands
                    available to  any new  menu by using the
                    COMMAND=NNN  environment  variable.  See
                    the miscellaneous  section at the end of
                    this  manual  for  more  information  on
                    expanding the  number of  allowable  DOS
                    commands. If  you think you are going to
                    need more than 15 DOS commands, then you
                    should set  the commands=nnn environment
                    variable first so that dMENU creates the
                    main.mnu  with  the  desired  number  of
                    commands. Once  a menu has been created,
                    you cannot  re-size it.  Only new  menus
                    are affected  by  the  set  commands=nnn
                    environment variable.

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson