home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 3 Comm / 03-Comm.zip / haotd1_1.zip / IBM.CMD < prev    next >
OS/2 REXX Batch file  |  1995-10-12  |  3KB  |  78 lines

  1. /* A REXX script MUST begin with a commented line              */
  2. /* Text within slashes and asterisks (like this line) are comments.      */
  3.  
  4. /*    $Revision: 1.5 $  */
  5. /*    $Date: 1995/09/15 13:41:39 $  */
  6.  
  7. /* This program ibm.cmd, created by Hilgraeve and assigned to the      */
  8. /* IBM National Support BBS phonebook entry runs an automated logon script */
  9. /* for connecting to the IBM National Support BBS. */
  10.  
  11. /* Parse the command line for arguments passed to this program */
  12. PARSE ARG pipename
  13.  
  14. /* Register external functions with REXX */
  15. CALL RxFuncAdd 'haLoadFuncs', 'HA_AUTO', 'RxhaLoadFuncs'
  16. CALL haLoadFuncs
  17.  
  18. /* Establish a link between this script program and HyperACCESS */
  19. scripthandle = 0
  20. scripthandle = haInitialize(1, pipename)
  21. DROP pipename
  22.  
  23. /* Process only if link with HyperACCESS was successful */
  24. IF scripthandle <> 0 THEN
  25.     DO
  26.     /* Initialize useful variables */
  27.     cr  = '0D'x        /* This is the hex value for carriage return */
  28.     lf  = '0A'x        /* This is the hex value for line feed         */
  29.     nul = '00'x        /* This is the hex value for null             */
  30.  
  31.     returnvalue = 0
  32.  
  33.     /* Wait for the name prompt */
  34.     IF returnvalue >= 0 THEN
  35.         returnvalue = haWaitForPrompt(scripthandle, 1, '-> ', 300, 19000)
  36.  
  37.     /* Grab the user name from the Runtime Values dialog */
  38.     IF returnvalue >= 0 THEN
  39.         returnvalue = haGetRuntimeValue(scripthandle, 1, 1, 128, 'szName')
  40.  
  41.     /* Type the user name in */
  42.     IF returnvalue >= 0 THEN
  43.         returnvalue = haTypeText(scriptHandle, 0, szName || cr)
  44.  
  45.     /* Wait for the password or new user prompt */
  46.     IF returnvalue >= 0 THEN
  47.         returnvalue = haWaitForPrompt(scripthandle, 2, '>'||'1B'x'[33;1m'nul', [N]o? 'nul, 300, 120000)
  48.  
  49.     /* If we get the first prompt, this means this person is already a user
  50.        on IBM's BBS.  We'll query their password setting and log them in,
  51.        otherwise, this person will need to provide some additional information
  52.        that we cannot answer with the script */
  53.     IF returnvalue == 0 THEN
  54.         DO
  55.         /* Grab the password from the Runtime Values dialog */
  56.         returnvalue = haGetRuntimeValue(scripthandle, 3, 1, 128, 'szPassword')
  57.  
  58.         /* Type the password in */
  59.         IF returnvalue >= 0 THEN
  60.             returnvalue = haTypeText(scripthandle, 0, szPassword || cr)
  61.  
  62.         /* Wait for the continue prompt and hit carriage return */
  63.         IF returnvalue >= 0 THEN
  64.             returnvalue = haWaitForPrompt(scripthandle, 1, 'ntinue? ', 300, 16000)
  65.         IF returnvalue >= 0 THEN
  66.             returnvalue = haTypeText(scripthandle, 0, cr)
  67.         END
  68.     ELSE
  69.         /* Inform this person that they are a new user and must login manually */
  70.         returnvalue = haMessageBox(scripthandle, "IBM National Support BBS", "You are a new user to IBM's BBS, please continue to login manually",0, nul, 2)
  71.     
  72.     /* Terminate link between HyperACCESS and script program */
  73.     CALL haTerminate scripthandle
  74.     END
  75.  
  76. DROP scripthandle
  77. CALL haDropFuncs
  78.