home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 3 Comm / 03-Comm.zip / haotd1_1.zip / OS2SHARE.CMD < prev    next >
OS/2 REXX Batch file  |  1995-10-12  |  3KB  |  84 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:41 $  */
  6.  
  7. /* This program os2share.cmd, created by Hilgraeve and assigned to the      */
  8. /* OS/2 Shareware BBS phonebook entry runs an automated logon script for */
  9. /* connecting to the OS/2 Shareware 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, 'r name: ', 300, 10000)
  36.  
  37.     /* Grab the User Name variable from the Runtime Values dialog */
  38.     IF returnvalue >= 0 THEN
  39.         returnvalue = haGetRuntimeValue(scripthandle, 1, 1, 128, 'name')           
  40.     
  41.     /* Type out the user name */
  42.     IF returnvalue >= 0 THEN
  43.         returnvalue = haTypeText(scripthandle, 0, name || cr)
  44.  
  45.     /* Wait for the yes or no prompt and hit carriage return */
  46.     IF returnvalue >= 0 THEN
  47.         returnvalue = haWaitForPrompt(scripthandle, 1, ' [Y,n]? ',300, 10000)
  48.     IF returnvalue >= 0 THEN
  49.         returnvalue = haTypeText(scripthandle, 0, cr)
  50.  
  51.     /* Wait for the password prompt */
  52.     IF returnvalue >= 0 THEN
  53.         returnvalue = haWaitForPrompt(scripthandle, 2,'ssword: 'nul'vince: 'nul, 300, 10000)
  54.  
  55.     /* If we get the password prompt, type the password, otherwise, this person
  56.        is a new user and must manually login */
  57.     IF returnvalue == 0 THEN
  58.         DO
  59.         /* Get the password value from the Runtime Values dialog */
  60.         returnvalue = haGetRuntimeValue(scripthandle, 3, 1, 128,'password')
  61.         IF returnvalue >= 0 THEN
  62.  
  63.             /* Type the password */
  64.             returnvalue = haTypeText(scripthandle, 0, password || cr)
  65.         
  66.         /* Wait for the continue prompt and hit carriage return */
  67.         IF returnvalue >= 0 THEN
  68.             returnvalue = haWaitForPrompt(scripthandle, 1, 'ontinue ', 300, 10000)
  69.         IF returnvalue >= 0 THEN
  70.             returnvalue = haTypeText(scripthandle, 0, cr)
  71.         END
  72.     ELSE
  73.         /* Prompt with this message when the user is new to the OS/2 Shareware
  74.            BBS.  They need to answer additional questions that we cannot answer
  75.            with the script */
  76.            returnvalue = haMessageBox(scripthandle, "OS/2 Shareware BBS Login","You are a new user to the OS/2 Shareware BBS, please continue to login manually",0, nul, 2)
  77.                                         
  78.     /* Terminate link between HyperACCESS and script program */
  79.     CALL haTerminate scripthandle
  80.     END
  81.  
  82. DROP scripthandle
  83. CALL haDropFuncs
  84.