home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD1.iso / Database / GBROUTE1,03PLUS.DMS / in.adf / ARexx / GBRCONSOLE.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1991-09-12  |  2.8 KB  |  72 lines

  1. /*****************************************************************************
  2. **                                                                          **
  3. **                       GBRoute Plus ARexx Script                          **
  4. **                                                                          **
  5. **                       (c) 1991 Complex Computers                         **
  6. **                                                                          **
  7. **  Name : gbrconsole.rexx                                                  **
  8. **                                                                          **
  9. **  Description : Calculates a route with optional 'Via'                    **
  10. **                                                                          **
  11. *****************************************************************************/
  12.  
  13. TEMPFILE = 'ram:$$temp'                /* This can be any valid filename    */
  14.  
  15. say 'GBRoute Plus ARexx Demonstration'
  16.  
  17. options prompt 'Enter Start: '; 
  18.                                        /* get starting place                */
  19. pull start
  20.  
  21. options prompt 'Enter Destination: '; 
  22.                                        /* get destination place             */
  23. pull dest
  24.  
  25. options prompt 'Via: (or Enter)'; 
  26.                                        /* get destination place             */
  27. pull via
  28.                                        /* send commands to GBRoute          */
  29. options results                        /* neeed this if we are to get       */
  30.                                        /* returned values                   */
  31. address GBR
  32. 'from' start
  33. p1 = result
  34. 'to' dest
  35. p2 = result
  36. 'via1' via
  37. v1 = result
  38. say 'Calculating journey from: 'p1' to: 'p2 ' via: 'v1
  39. 'go'
  40.                                        /* Check for no route                */
  41. if result == 'RESULT' then do
  42.                                        /* output journey to file            */
  43.    'file' TEMPFILE
  44.                                        /* open file                         */
  45.    open(file, TEMPFILE, read)
  46.                                        /* loop until the end of the file    */
  47.    do while eof(file)=0
  48.                                        /* read a line from file             */
  49.       st = readln(file)
  50.                                        /* and print it                      */
  51.       say st
  52.    end
  53.                                        /* close the file                    */
  54.    close(file)
  55.  
  56.    address command
  57.    delete TEMPFILE
  58.  
  59.    address 'GBR'
  60.  
  61.    'dist'
  62.    d = result
  63.    'time'
  64.    t = result
  65.    'cost'
  66.    c = trunc(result/100,2)             /* pounds.pence                      */
  67.    say 'This journey costs £'c' and takes 't'mins covering 'd' miles!'
  68.    end
  69.                                        /* Route not possible                */
  70. else say result
  71. exit
  72.