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

  1. // FFREE.SCP Sample Script for France Telecom
  2. // Copyright (c) 1999, Vector Networks Limited
  3. // All Rights Reserved
  4. //
  5. // Revision History:
  6. //  0.0 03-Sep-99 AB  - Created.
  7. //      08-Sep-99 DB  - Enable remote control functions.
  8. //      12-Oct-99 DB  - Change parameter order for v5 GetClientsInGroup
  9. //                    - Switch to full-screen mode.
  10. //      14-Oct-99 DB  - Add Wait (1) after the View ends to avoid crash.
  11. //      01-Nov-99 DB  - Add Connect () error display
  12.  
  13. // Script requirements:-
  14. //  Predefined variables:
  15. //      Client = " "
  16. //      CGroup = " "
  17. //
  18. // This script connects to either:
  19. //       a) the Client specified in variable Client,
  20. //       b) the first Availble Client in the Group specified in variable CGroup,
  21. //       c) the first Available Client in the Known Clients database.
  22. //
  23. // The script will only Connect to a specified client or group if the variables 
  24. // Client or CGroup have been predefined as non-blank strings.
  25.  
  26. Function Main ()
  27. Dim Client, CGroup
  28. Dim AllClients, CClient, Status
  29.  
  30.     // Check the pre-defined variables
  31.  
  32. //    If IsUndefined (Client) then
  33. //        Client = ""
  34. //    Endif
  35. //    If IsUndefined (CGroup) then
  36. //        CGroup = ""
  37. //    Endif
  38.  
  39.     SetTransport (T_TCPIP)
  40.  
  41.     // The script decides whether a client or group has been specified.  
  42.     // If so, the client/clients are added to the AllClients list.  
  43.     // If not, the client database is used for the AllClients list.
  44.  
  45.     Client = Trim (Client) 
  46.     CGroup = Trim (CGroup)     
  47.  
  48.     If Client != "" Then 
  49.         AddItem (AllClients, Client)
  50.     Else 
  51.         If CGroup != "" Then 
  52.             GetClientsInGroup (CGroup, AllClients)
  53.         Else 
  54.             GetAllClients (AllClients)
  55.         EndIf
  56.     EndIf
  57.  
  58.     // The script searches through the clients in the AllClients list, connecting
  59.     // to the first available client. If the Connect succeeds, then the status 
  60.     // variable is set TRUE.  If connection fails with all clients then status 
  61.  
  62.     // remains FALSE and the program returns an unsuccessful result.
  63.  
  64.     NumClients = Items (AllClients)
  65.     Print NumClients, " Clients found"
  66.  
  67.     If NumClients > 0 Then 
  68.         For Each CClient in AllClients
  69.             Trim (CClient)
  70.             Print "Trying Client ", GetClientName (CClient)
  71.             If Connect (CClient) = TRUE Then 
  72.                 Print "Connected to Client ", GetClientName (CClient)
  73.  
  74.                 // Execute pre-remote control command(s) 
  75.                 // Exec (">c:\")
  76.  
  77.                 Wait (1)
  78.  
  79.                 // Start a remote control session and wait for it to end
  80.  
  81.                 Status = Share ()
  82.                 Print "View status = ", Status
  83.                 SetWindowMode (FALSE)
  84.                 WaitEndView ()
  85.                 Print "WaitEndView status = ", Status
  86.  
  87.                 // Execute post-remote control command(s) 
  88.                 // Exec (">c:\")
  89.  
  90.                 Status = TRUE
  91.                 Wait (1)
  92.                 Disconnect (CClient)
  93.                 Exit For
  94.             Else
  95.                 Print "Connect failed, error ", LASTERROR, " = ", LASTERRORSTRING
  96.             EndIf
  97.         Next CClient
  98.     EndIf
  99.  
  100.     If Status = TRUE Then 
  101.         Print "Script completed successfully!"
  102. //      Abort (0)
  103.     Else
  104.         Print "Script was unsuccessful!"
  105.         Abort (1)
  106.     EndIf
  107.  
  108. End Function
  109.