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

  1. /* This program newsnet.cmd created by Hilgraeve and assigned to the Newsnet */
  2. /*  phonebook entry runs an automated logon script for connecting to Newsnet.*/
  3.  
  4. /*    $Revision: 1.5 $  */
  5. /*    $Date: 1995/09/15 13:41:40 $  */
  6.  
  7. /* Text within slashes and asterisks (like this line) are comments. */
  8. /* Parse the command line for arguments passed to this program */
  9. PARSE ARG pipename
  10.  
  11. /* Register external functions with REXX */
  12. CALL RxFuncAdd 'haLoadFuncs', 'HA_AUTO', 'RxhaLoadFuncs'
  13. CALL haLoadFuncs
  14.  
  15. /* Establish a link between this script program and HyperACCESS */
  16. scripthandle = 0
  17. scripthandle = haInitialize(1, pipename)
  18. DROP pipename
  19.  
  20. /* Process only if link with HyperACCESS was successful */
  21. IF scripthandle <> 0 THEN
  22.     DO
  23.     /* Initialize useful variables */
  24.     cr  = '0D'x
  25.     lf  = '0A'x
  26.     nul = '00'x
  27.     returnvalue = 0
  28.  
  29.     /* Pause 1 second */
  30.     IF (ReturnValue >= 0) THEN  
  31.         ReturnValue = haSleep(scripthandle, 1000)
  32.  
  33.     /* Type a '@D' */
  34.     IF returnvalue >= 0 THEN
  35.         returnvalue = haTypeText(scripthandle, 0, '@D')
  36.  
  37.     /* Pause 1 second */
  38.     IF (ReturnValue >= 0) THEN  
  39.         ReturnValue = haSleep(scripthandle, 1000)
  40.  
  41.     /* Type an <enter> */
  42.     IF returnvalue >= 0 THEN
  43.         returnvalue = haTypeText(scripthandle, 0, cr)
  44.  
  45.     /* Wait for one of three prompts possible - first is Tymenet, 2nd or 3rd is Telenet */
  46.     IF returnvalue >= 0 THEN
  47.         returnvalue = haWaitForPrompt(scripthandle, 3, 'ERMINAL='nul'r name: 'nul'identifier'nul, 300, 18000) 
  48.  
  49.     /* If Tymenet do this block */
  50.     IF returnvalue == 0 THEN 
  51.         DO
  52.         /* Type an <enter> */
  53.         returnvalue = haTypeText(scripthandle, 0, cr)
  54.  
  55.         /* Wait for a prompt */
  56.         IF returnvalue >= 0 THEN
  57.             returnvalue = haWaitForPrompt(scripthandle, 1, '@', 300, 16000)
  58.  
  59.         /* Type text to request Newsnet */
  60.         IF returnvalue >= 0 THEN 
  61.             returnvalue = haTypeText(scripthandle, 0, 'c net'cr)
  62.         END
  63.  
  64.     /* If Telenet do this block */
  65.     ELSE 
  66.         DO
  67.         /* Type an 'a' */
  68.         returnvalue = haTypeText(scripthandle, 0, 'a')
  69.  
  70.         /* Wait for a prompt */
  71.         IF returnvalue >= 0 THEN
  72.             returnvalue = haWaitForPrompt(scripthandle, 1, 'log in: ', 300, 22000)
  73.  
  74.         /* Type text requesting Bix */
  75.         IF returnvalue >= 0 THEN
  76.             returnvalue = haTypeText(scripthandle, 0, 'net'cr)
  77.         END
  78.  
  79.     /* Wait for a Newsnet prompt */
  80.     IF returnvalue >= 0 THEN
  81.         returnvalue = haWaitForPrompt(scripthandle, 1, '-->', 300, 11000)
  82.  
  83.     /* Get User ID value from Runtime Values dialog box */
  84.     IF returnvalue >= 0 THEN
  85.         returnvalue = haGetRuntimeValue(scripthandle, 2, 1, 128, 'Buffer')
  86.  
  87.     /* Add value to the login line */
  88.     IF returnvalue >= 0 THEN
  89.         DO
  90.         Buffer = LEFT(Buffer, LENGTH(Buffer) - 1)
  91.         logline = 'ID ' || Buffer
  92.         END
  93.  
  94.     /* Get Password value from Runtime Values dialog box */
  95.     IF returnvalue >= 0 THEN
  96.         returnvalue = haGetRuntimeValue(scripthandle, 3, 1, 128, 'Bufferpas')
  97.  
  98.     /* Add value to the log line */
  99.     IF returnvalue >= 0 THEN
  100.         logline = logline || ' ' || Bufferpas
  101.  
  102.     /*Type the login line */
  103.     IF returnvalue >= 0 THEN
  104.         returnvalue = haTypeText(scripthandle, 0, logline || cr)
  105.  
  106.     /* Terminate link between HyperACCESS and script program */
  107.     CALL haTerminate scripthandle
  108.     END
  109.  
  110. DROP scripthandle
  111. CALL haDropFuncs
  112.