home *** CD-ROM | disk | FTP | other *** search
/ Stars of Shareware: DFÜ und Kommunikation / SOS-DFUE.ISO / programm / windows / terminal / hawtd1 / attmail.c next >
Encoding:
C/C++ Source or Header  |  1993-04-26  |  1.8 KB  |  59 lines

  1. /* This program attmail.c created by Hilgraeve and assigned to the attmail session*/
  2. /* runs an automated logon script for connecting to AT&T Mail.                    */
  3.  
  4. /*    $Revision: 1.1 $  */
  5. /*    $Date: 1993/04/26 15:22:16 $  */
  6.  
  7. /* Define main function, which is always the starting point of C programs. */
  8. /* (The term "void" indicates that the function returns no value.) */
  9. void main()
  10.     {
  11.     /* Declare variables */
  12.     long ScriptHandle;
  13.     int ReturnValue;
  14.     char Buffer[128];
  15.  
  16.     /* Initialize variables */
  17.     ReturnValue = 0;
  18.     ScriptHandle = 0;
  19.  
  20.     /* Establish a link between this script program and HA/Win */
  21.     ScriptHandle = haInitialize(0,0,0,0);
  22.  
  23.     /* Exit if intialization of link with HA/Win failed */
  24.     if (ScriptHandle == 0) exit();
  25.         
  26.     /* Type two consecutive <Enter> with pauses */
  27.     haSleep(ScriptHandle, 2197L);
  28.     haTypeText(ScriptHandle, 0, "\r");
  29.     haSleep(ScriptHandle, 494L);
  30.     haTypeText(ScriptHandle, 0, "\r");
  31.  
  32.     /* Wait for a prompt */
  33.     ReturnValue = haWaitForPrompt(ScriptHandle, 1, "User Name: ", 300L, 32000L);
  34.  
  35.     /* Get User Name value from Runtime Values dialog box */
  36.     if (ReturnValue >= 0)
  37.         ReturnValue = haGetRuntimeValue(ScriptHandle, 1, 1, 128, Buffer);
  38.  
  39.     /* Type the value */
  40.     if (ReturnValue >= 0)
  41.         ReturnValue = haTypeText(ScriptHandle, 0, Buffer);
  42.  
  43.     /* Wait for a prompt */
  44.     if (ReturnValue >= 0)
  45.         ReturnValue = haWaitForPrompt(ScriptHandle, 1, "assword:", 300L, 32000L);
  46.  
  47.     /* Get Password value from Runtime Values dialog box */
  48.     if (ReturnValue >= 0)
  49.         ReturnValue = haGetRuntimeValue(ScriptHandle, 3, 1, 128, Buffer);
  50.  
  51.     /* Type the value */
  52.     if (ReturnValue >= 0)
  53.         ReturnValue = haTypeText(ScriptHandle, 0, Buffer);
  54.  
  55.     /* Terminate link between HA/Win and script program */
  56.     haTerminate(ScriptHandle, 0);
  57.     }
  58.  
  59.