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

  1. // LOOKUP.SCP Sample Script
  2. // Copyright (c) 1999, Vector Networks Limited
  3. // All Rights Reserved
  4. //
  5. // Revision History:
  6. //  5.0 09-Dec-99 DB  - Created.
  7.  
  8. //  This is a simple script which performs a LookUp on 
  9. //  TCP/IP. For each Client that responds, it calls 
  10. //  ProcessClient which can be modified to do 
  11. //  whatever you want...
  12.  
  13. Function Main ()
  14.  Dim ClientsList, ClientNum, ClientTotal
  15.  Dim CurClient, ClientName
  16.  
  17.  SetTransport (T_TCPIP)
  18.  
  19.  Print "Browsing the Network for Clients. Please wait..."
  20.  
  21.  LookUp ("", ClientsList)
  22.  ClientTotal = Items (ClientsList) 
  23.  Print CStr (ClientTotal), " Clients found"
  24.  ClientNum = 1
  25.  
  26.  // Now, work through the list of Clients
  27.  
  28.  For Each CurClient in ClientsList
  29.   ClientName = GetClientName (CurClient)
  30.  
  31.   If ProcessClient (CurClient, ClientName) Then
  32.     Print "Client ", ClientNum, " <", ClientName, "> processed successfully"
  33.   Else
  34.     Print "Client ", ClientNum, " <", ClientName, "> processing FAILED"
  35.   EndIf
  36.   ClientNum = ClientNum + 1
  37.  Next
  38. End Function
  39.  
  40. //  ProcessClient is a generic Function which can be altered 
  41. //  to Do almost anything on a specific, named Client.
  42.  
  43. Function ProcessClient (CurClient, ClientName)
  44.   Print "Processing Client <", ClientName, ">"
  45.  
  46.   If Connect (CurClient) == TRUE Then
  47.     Print "Connected to ", ClientName
  48.     Disconnect (CurClient)
  49.     ProcessClient = TRUE
  50.   Else
  51.     Print "Unable to connect to ", ClientName
  52.     Print "Error ", LASTERROR, " = ", LASTERRORSTRING
  53.     ProcessClient = FALSE
  54.   EndIf
  55. End Function
  56.