home *** CD-ROM | disk | FTP | other *** search
- // FFREE.SCP Sample Script for France Telecom
- // Copyright (c) 1999, Vector Networks Limited
- // All Rights Reserved
- //
- // Revision History:
- // 0.0 03-Sep-99 AB - Created.
- // 08-Sep-99 DB - Enable remote control functions.
- // 12-Oct-99 DB - Change parameter order for v5 GetClientsInGroup
- // - Switch to full-screen mode.
- // 14-Oct-99 DB - Add Wait (1) after the View ends to avoid crash.
- // 01-Nov-99 DB - Add Connect () error display
-
- // Script requirements:-
- // Predefined variables:
- // Client = " "
- // CGroup = " "
- //
- // This script connects to either:
- // a) the Client specified in variable Client,
- // b) the first Availble Client in the Group specified in variable CGroup,
- // c) the first Available Client in the Known Clients database.
- //
- // The script will only Connect to a specified client or group if the variables
- // Client or CGroup have been predefined as non-blank strings.
-
- Function Main ()
- Dim Client, CGroup
- Dim AllClients, CClient, Status
-
- // Check the pre-defined variables
-
- // If IsUndefined (Client) then
- // Client = ""
- // Endif
- // If IsUndefined (CGroup) then
- // CGroup = ""
- // Endif
-
- SetTransport (T_TCPIP)
-
- // The script decides whether a client or group has been specified.
- // If so, the client/clients are added to the AllClients list.
- // If not, the client database is used for the AllClients list.
-
- Client = Trim (Client)
- CGroup = Trim (CGroup)
-
- If Client != "" Then
- AddItem (AllClients, Client)
- Else
- If CGroup != "" Then
- GetClientsInGroup (CGroup, AllClients)
- Else
- GetAllClients (AllClients)
- EndIf
- EndIf
-
- // The script searches through the clients in the AllClients list, connecting
- // to the first available client. If the Connect succeeds, then the status
- // variable is set TRUE. If connection fails with all clients then status
-
- // remains FALSE and the program returns an unsuccessful result.
-
- NumClients = Items (AllClients)
- Print NumClients, " Clients found"
-
- If NumClients > 0 Then
- For Each CClient in AllClients
- Trim (CClient)
- Print "Trying Client ", GetClientName (CClient)
- If Connect (CClient) = TRUE Then
- Print "Connected to Client ", GetClientName (CClient)
-
- // Execute pre-remote control command(s)
- // Exec (">c:\")
-
- Wait (1)
-
- // Start a remote control session and wait for it to end
-
- Status = Share ()
- Print "View status = ", Status
- SetWindowMode (FALSE)
- WaitEndView ()
- Print "WaitEndView status = ", Status
-
- // Execute post-remote control command(s)
- // Exec (">c:\")
-
- Status = TRUE
- Wait (1)
- Disconnect (CClient)
- Exit For
- Else
- Print "Connect failed, error ", LASTERROR, " = ", LASTERRORSTRING
- EndIf
- Next CClient
- EndIf
-
- If Status = TRUE Then
- Print "Script completed successfully!"
- // Abort (0)
- Else
- Print "Script was unsuccessful!"
- Abort (1)
- EndIf
-
- End Function
-