home *** CD-ROM | disk | FTP | other *** search
- // GTREMOTE.SCP - Sample Script which reads from REMOTE.NSM
- // Copyright (c) 2001-2002, Vector Networks Limited
- // All Rights Reserved
- //
- // Revision History:
- // 7.0 20-Mar-02 DB - Separated from GRPFLUPD.SCP.
-
- // GetRemote is used to retrieve full details of a Remote Network from the
- // Known Networks file, REMOTE.NSM, returning the results in a string.
- // There are no built-in functions to do this directly.
- //
- // The REMOTE.NSM file is in the following format:-
- // Name|Description|Number|Transport
-
- Function GetRemote (Network as String, Profile as String) as String
- Dim RemoteName as String, RemoteFile as String, Line as String
- Dim Handle, Lines, Tokens, SplitLine as List, NetworkDetails as String
- Dim CurrentGroup as String, ClientCount
-
- // Initialise counter variables
-
- Lines = 0
-
- If Len (Network) > 0 Then
- Print "Searching for Remote Network : ", Network
-
- // Now, we look it up in the GROUP.NSM file.
-
- RemoteFile = GetControlFile ("REMOTE.NSM", Profile)
-
- If (FileExists (RemoteFile)) Then
- Handle = Open (RemoteFile, FILE_READ)
-
- If Handle !=0 Then
- Print "Reading file " + RemoteFile + "..."
- Print "File handle: ", Handle
-
- Lines = 0
-
- Do Until EOF (Handle)
- Line = ReadLine (Handle)
- Lines = Lines + 1
- Print "Line ", Lines, " <", Line, ">"
-
- If Trim (Line) != "" Then
- SplitLine = TokenList (Line, "|")
- If Items (SplitLine) > 3 Then
- RemoteName = GetItem (SplitLine, 1)
- If (RemoteName = Network) Then
- NetworkDetails = Line
- Exit Do
- Endif
- Endif
- Else
- Print "Skipping blank line"
- Endif
- Loop
-
- Print "Summary"
- Print Lines, " lines processed"
- Close (Handle)
- Endif
- Else
- Print "ERROR: Unable to open Remote file : ", RemoteFile
- Endif
- Else
- // No Remote Network name provided
- Endif
-
- If (NetworkDetails != "") Then
- Print "Network : ", Network, " Details : ", NetworkDetails
- Endif
- GetRemote = NetworkDetails
- End Function
-