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

  1. /* This program delphi.cmd, created by Hilgraeve and assigned to the */
  2. /* Delphi phonebook entry runs an automated logon script for connecting */
  3. /* to the Delphi service */
  4.  
  5. /*    $Revision: 1.6 $  */
  6. /*    $Date: */
  7.  
  8. /* A REXX script MUST begin with a commented line */
  9. /* Text within slashes and asterisks (like this line) are comments. */
  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.  
  27.         /* Initialize useful variables */
  28.         cr  = '0D'x
  29.         lf  = '0A'x
  30.         nul = '00'x
  31.         returnvalue = 0
  32.  
  33.  
  34.         /* Type a '@' then <enter> */
  35.         IF returnvalue >= 0 THEN
  36.                 returnvalue = haTypeText(scripthandle, 0, '@')
  37.  
  38.         /* Pause */
  39.         IF returnvalue >= 0 THEN
  40.                 returnvalue = haSleep(ScriptHandle, 1000L)
  41.  
  42.         /* Type a  <enter> */
  43.         IF returnvalue >= 0 THEN
  44.                 returnvalue = haTypeText(ScriptHandle, 0, cr)
  45.  
  46.         /* Wait for one of three prompts possible with Tymenet or Telenet */
  47.         IF returnvalue >= 0 THEN
  48.                 ReturnValue = haWaitForPrompt(ScriptHandle, 3, "ERMINAL="nul"r name: "nul"identifier"nul, 300, 32000)
  49.  
  50.         /* If Tymenet do this block */
  51.         IF returnvalue == 0 THEN
  52.                 DO
  53.                 /* Type an <enter> */
  54.                 ReturnValue = haTypeText(ScriptHandle, 0, cr)
  55.  
  56.                 /* Wait for a prompt */
  57.                 IF returnvalue >= 0 THEN
  58.                         ReturnValue = haWaitForPrompt(ScriptHandle, 1, "@", 300, 32000)
  59.  
  60.                 /* Type text to request Delphi */
  61.                 IF returnvalue >= 0 THEN
  62.                         ReturnValue = haTypeText(ScriptHandle, 0, "c delphi"cr)
  63.                 END
  64.         /* If Telenet do this block */
  65.         else
  66.                 DO
  67.                 /* Type an 'o' */
  68.                 ReturnValue = haTypeText(ScriptHandle, 0, "o")
  69.  
  70.                 /* Wait for a prompt */
  71.                 IF returnvalue >= 0 THEN
  72.                         ReturnValue = haWaitForPrompt(ScriptHandle, 1, "log in: ", 300, 32000)
  73.  
  74.                 /* Type text requesting Delphi */
  75.                 IF returnvalue >= 0 THEN
  76.                         ReturnValue = haTypeText(ScriptHandle, 0, "delphi"cr)
  77.                 END
  78.  
  79.         /* Wait for a prompt */
  80.         IF returnvalue >= 0 THEN
  81.                 ReturnValue = haWaitForPrompt(ScriptHandle, 1, "ername: ", 300, 32000)
  82.  
  83.         /* Get User Name from Runtime Values dialog box */
  84.         IF returnvalue >= 0 THEN
  85.                 ReturnValue = haGetRuntimeValue(ScriptHandle, 1, 1, 128, 'UName')
  86.  
  87.         /* Type the value */
  88.         IF returnvalue >= 0 THEN
  89.                 ReturnValue = haTypeText(ScriptHandle, 0, UName||cr)
  90.  
  91.         /* Wait for a prompt */
  92.         IF returnvalue >= 0 THEN
  93.                 ReturnValue = haWaitForPrompt(ScriptHandle, 1, "ssword: ", 300, 32000)
  94.  
  95.         /* Get Password value from Runtime Values dialog box */
  96.         IF returnvalue >= 0 THEN
  97.                 ReturnValue = haGetRuntimeValue(ScriptHandle, 3, 1, 128, 'PWord')
  98.  
  99.         /* Type the value */
  100.         IF returnvalue >= 0 THEN
  101.                 ReturnValue = haTypeText(ScriptHandle, 0, PWord||cr)
  102.  
  103.         /* Terminate link between HyperACCESS and script program */
  104.         CALL haTerminate scripthandle
  105.         END
  106. DROP scripthandle
  107. CALL haDropFuncs
  108.  
  109.