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

  1. /* This program dowjones.cmd, created by Hilgraeve and assigned to the */
  2. /* Dow Jones phonebook entry runs an automated logon script for connecting */
  3. /* to the Dow Jones 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.         if ReturnValue >= 0 THEN
  34.                 ReturnValue = haSetLocalEcho(ScriptHandle, 1)
  35.  
  36.         /* Type a '@' then <enter> */
  37.         if ReturnValue >= 0 THEN
  38.                 ReturnValue = haTypeText(ScriptHandle, 0, "@")
  39.  
  40.         /* Pause */
  41.         if ReturnValue >= 0 THEN
  42.                 ReturnValue = haSleep(ScriptHandle, 1000)
  43.  
  44.         /* Type a  <enter> */
  45.         if ReturnValue >= 0 THEN
  46.                 ReturnValue = haTypeText(ScriptHandle, 0, cr)
  47.  
  48.         /* Turn local echo off */
  49.         if ReturnValue >= 0 THEN
  50.                 ReturnValue = haSetLocalEcho(ScriptHandle, 0)
  51.  
  52.         /* Wait for one of three prompts possible with Tymenet or Telenet */
  53.         if ReturnValue >= 0 THEN
  54.                 ReturnValue = haWaitForPrompt(ScriptHandle, 3, "ERMINAL="nul"r name: "nul"identifier"nul, 300, 32000)
  55.  
  56.         if ReturnValue == 0 THEN
  57.                 /* If Telenet do this block */
  58.                 DO
  59.                 /* Type an <enter> */
  60.                 ReturnValue = haTypeText(ScriptHandle, 0, cr)
  61.  
  62.                 /* Wait for a prompt */
  63.                 if ReturnValue >= 0 THEN
  64.                         ReturnValue = haWaitForPrompt(ScriptHandle, 1, "@", 300, 32000)
  65.  
  66.                 /* Type text to request Dow Jones */
  67.                 if ReturnValue >= 0 THEN
  68.                         ReturnValue = haTypeText(ScriptHandle, 0, "c dow"cr)
  69.                 END
  70.         else
  71.                 /* If Tymenet do this block */
  72.                 DO
  73.                 /* Type an 'a' */
  74.                 ReturnValue = haTypeText(ScriptHandle, 0, "a")
  75.  
  76.                 /* Wait for a prompt */
  77.                 if ReturnValue >= 0 THEN
  78.                         ReturnValue = haWaitForPrompt(ScriptHandle, 1, "log in: ", 300, 32000)
  79.  
  80.                 /* Type text requesting Dow Jones */
  81.                 if ReturnValue >= 0 THEN
  82.                         ReturnValue = haTypeText(ScriptHandle, 0, "dow1;;")
  83.                 END
  84.  
  85.         /* Wait for a prompt */
  86.         if ReturnValue >= 0 THEN
  87.                 ReturnValue = haWaitForPrompt(ScriptHandle, 1, "SE????"||cr||lf, 300, 32000)
  88.  
  89.         /* Type text to request Dow Jones */
  90.         if ReturnValue >= 0 THEN
  91.                 ReturnValue = haTypeText(ScriptHandle, 0, "djns"cr)
  92.  
  93.         /* Pause */
  94.         if ReturnValue >= 0 THEN
  95.                 ReturnValue = haSleep(ScriptHandle, 2000)
  96.  
  97.         /* Get Password value from Runtime Values dialog box and add to logline */
  98.         if ReturnValue >= 0 THEN
  99.                 DO
  100.                 ReturnValue = haGetRuntimeValue(ScriptHandle, 3, 1, 128, 'PWord')
  101.                 END
  102.  
  103.         /* Get User ID value from Runtime Values dialog box and add to logline */
  104.         if ReturnValue >= 0 THEN
  105.                 DO
  106.                 ReturnValue = haGetRuntimeValue(ScriptHandle, 2, 1, 128, 'UserID');
  107.                 END
  108.  
  109.         /* Type the logline */
  110.         if ReturnValue >= 0 THEN
  111.                 ReturnValue = haTypeText(ScriptHandle, 0, PWord||UserID)
  112.  
  113.         /* Terminate link between HyperACCESS and script program */
  114.         CALL haTerminate scripthandle
  115.         END
  116.  
  117. DROP scripthandle
  118. CALL haDropFuncs
  119.