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

  1. // STEST.SCP - Sample Script for Siemens
  2. // Copyright (c) 1999, Vector Networks Limited
  3. // All Rights Reserved
  4. //
  5. // Revision History:
  6. //  0.0 12-Oct-99 DB  - Created.
  7. //  5.3 31-May-00 DB  - Separate log file code to ADDTOLOG.SCP.
  8. //                   - Use SetWindowMode (2) instead of FALSE.
  9. //  5.31 09-Jun-00 DB  - Improve resistance to undefined variables
  10.  
  11. $INCLUDE "ADDTOLOG.SCP"
  12.  
  13. // Script requirements:-
  14. //  Predefined variables:
  15. //    Client = "VECNET"
  16. //    User = "DB"
  17. //    Username = "SCRIPTING/GBBLLYDGKK"
  18. //
  19. //  The Script attempts to connect to the Client named in variable Client, using
  20. //  the username (and password) contained in variable Username.
  21.  
  22. Function Main ()
  23. Dim Client as String, User as String, Username as String
  24. Dim Filename as String, InstallDir as String
  25. Dim Handle, Status
  26.  
  27.     SetTransport (T_TCPIP)
  28.  
  29.     //  Make sure we have something in User
  30.  
  31.     If Trim (User) = "" then 
  32.         User = "UNKNOWN"
  33.     Endif
  34.  
  35.     If Connect (Client, Username) = TRUE Then 
  36.         Print "Logging User Access"
  37.         InstallDir = GetInstallDir ("")
  38.         FileName = ">" + InstallDir + "\" + User + ".LOG"
  39.  
  40.         AddToLog (FileName, User + " connected")
  41.  
  42.         Print "Opening View"
  43.         Control ()
  44.         SetWindowMode (2)
  45.         WaitEndView ()
  46.  
  47.         AddToLog (FileName, User + " disconnected")
  48.  
  49.         Print "Disconnecting..."
  50.         Wait (2)
  51.         Disconnect (Client)
  52.     EndIf
  53. End Function
  54.  
  55.