home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 April / CMCD0404.ISO / Software / Demo / PCDUO / data1.cab / Script_Samples / DIALTEST.SCP < prev    next >
Encoding:
Text File  |  2003-11-28  |  3.9 KB  |  138 lines

  1. // DIALTEST.SCP - Repeated dial and connect to test modem 
  2. // Copyright (c) 2001, Vector Networks Limited
  3. // All Rights Reserved
  4. //
  5. // Revision History:
  6. // 6.10 11-May-01 DB - Created, using KUKATEST.SCP v6.00. 20-Sep-00.
  7. // 6.11 22-May-01 DB - Allow for " " as dummy pre-defined variable(s).
  8.  
  9. //  Predefined variables:
  10. //    ClientName = "" - Name of Client at remote site
  11. //    DialNumber = "0123456789" - Number to use to dial Bridge
  12. //    OpenView = 1 - Opens a View Window (interactive)
  13. //    Password = "GBBLLYDGKK" - Encrypted password for remote network
  14. //    TestFile = "NSM.LIC" - File to check at Client
  15. //    Username = "SCRIPTING/GBBLLYDGKK" - Username and password for Connect
  16. //
  17. //  Tuning variables:
  18. //    ConnectDelay = 1 - After dialling, before connecting
  19. //    DialDelay = 10 - Before dialling
  20. //    DisconnectDelay = 1- Before disconnecting
  21. //    HangupDelay = 10 - After disconnecting, before hanging up
  22. //    LoopDelay = 1 - Delay at end of every loop
  23.  
  24. Function Main ()
  25. Dim ClientName as String, DialNumber as String, UserName as String, Password as String
  26. Dim DialUp as Integer, OpenView as Integer, TestFile as String, TestPath as String
  27. Dim Loops, LoopMax, ConnectErrors, DialErrors, TotalErrors
  28. Dim ConnectDelay, DialDelay, DisconnectDelay, HangupDelay, LoopDelay
  29.  
  30.   //  Check for pre-defined variables and add default values
  31.   //  if any are not defined
  32.  
  33.   If (Trim (ClientName)) = "" Then
  34.     ClientName = "TEST4"
  35.   Endif
  36.   If DialNumber = "" Then
  37.     DialNumber = "50987"
  38.   Else
  39.     DialNumber = Trim (DialNumber)
  40.   Endif
  41.   If TestFile = "" Then
  42.     TestFile = "NSM.LIC"
  43.   Else
  44.     TestFile = Trim (TestFile)
  45.   Endif
  46.  
  47.   // Initialise counter variables
  48.  
  49.   Loops = 0
  50.   ConnectErrors = 0
  51.   DialErrors = 0
  52.   TotalErrors = 0
  53.  
  54.   //  Set the maximum loop count
  55.  
  56.   LoopMax = 100
  57.  
  58.   //  and the various delay timers
  59.  
  60.   ConnectDelay = 1
  61.   DialDelay = 10
  62.   DisconnectDelay = 1
  63.   HangupDelay = 10
  64.   LoopDelay = 1
  65.  
  66.   If DialNumber != "" Then
  67.     SetTransport (T_TCPIP, T_REMOTE)
  68.   Else
  69.     SetTransport (T_TCPIP)
  70.   Endif
  71.  
  72.   For Loops = 1 to LoopMax
  73.     If DialNumber != "" Then
  74.       If (DialDelay > 0) Then
  75.         Print "Pause before dialling..."
  76.         Wait (DialDelay)
  77.       Endif
  78.       DialUp = Dial (DialNumber, Password)
  79.       If DialUp = TRUE Then
  80.         Print "Connected to Bridge at ", DialNumber
  81.         If (ConnectDelay > 0) Then
  82.           Print "Pause before connectling..."
  83.           Wait (ConnectDelay)
  84.         Endif
  85.       Else
  86.         Print "Dial failed in test cycle ", Loops, "."
  87.         DialErrors = DialErrors + 1
  88.         TotalErrors = TotalErrors + 1
  89.         Goto LoopEnd
  90.       Endif
  91.     Endif
  92.     If Connect (ClientName, UserName) Then
  93.       Print "Connected to Client ", ClientName
  94.       If TestFile != "" Then
  95.         If FileExists (">" + GetInstallDir ("") + "\" + TestFile) Then
  96.           Print "Test File ", TestFile, " found"
  97.         Endif
  98.       Endif
  99.       If OpenView != 0 Then
  100.         Share ()
  101.         SetWindowMode (2)
  102.         WaitEndView ()
  103.       Endif
  104.       If (DisconnectDelay > 0) Then
  105.         Print "Pause before disconnectling..."
  106.         Wait (DisconnectDelay)
  107.       Endif
  108.       Disconnect (ClientName)
  109.       Print "Test cycle ", Loops, " completed."
  110.     Else
  111.       Print "Test cycle ", Loops, " failed."
  112.       ConnectErrors = ConnectErrors + 1
  113.       TotalErrors = TotalErrors + 1
  114.     Endif
  115.     If DialUp Then
  116.       If (HangupDelay > 0) Then
  117.         Print "Pause before hanging up..."
  118.         Wait (HangupDelay)
  119.       Endif
  120.       Hangup ()
  121.       DialUp = FALSE
  122.     Endif
  123.  
  124. LoopEnd:
  125.     If (LoopDelay > 0) Then
  126.       Print "Pause before looping..."
  127.       Wait (LoopDelay)
  128.     Endif
  129.   Next
  130.  
  131.   Print "Test Summary"
  132.   Print " Cycles completed : ", Loops
  133.   Print " Dial Errors : ", DialErrors
  134.   Print " Connect Errors : ", ConnectErrors
  135.   Print " Total Errors : ", TotalErrors
  136.  
  137. End Function
  138.