home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 Special / chip-cd_2001_spec_05.zip / spec_05 / ras.cab / networkprotocol.vbs < prev    next >
Text File  |  1999-11-04  |  24KB  |  660 lines

  1. '********************************************************************
  2. '*
  3. '* File:           NetworkProtocol.vbs
  4. '* Created:        March 1999
  5. '* Version:        1.0
  6. '*
  7. '*  Main Function:  Displays Network Protocol Information.
  8. '*
  9. '*  BootConfig.vbs  [/S <server>] [/U <username>] [/W <password>]
  10. '*                  [/O <outputfile>]
  11. '*
  12. '* Copyright (C) 1999 Microsoft Corporation
  13. '*
  14. '********************************************************************
  15.  
  16.  
  17. OPTION EXPLICIT
  18.  
  19.     'Define constants
  20.     CONST CONST_ERROR                   = 0
  21.     CONST CONST_WSCRIPT                 = 1
  22.     CONST CONST_CSCRIPT                 = 2
  23.     CONST CONST_SHOW_USAGE              = 3
  24.     CONST CONST_LIST                    = 4
  25.  
  26.     'Declare variables
  27.     Dim intOpMode
  28.     Dim strServer, strUserName, strPassword, strOutputFile
  29.  
  30.     'Make sure the host is csript, if not then abort
  31.     Call VerifyHostIsCscript()
  32.  
  33.     'Parse the command line
  34.     intOpMode = intParseCmdLine(strServer,        _
  35.                                 strUserName,      _
  36.                                 strPassword,      _
  37.                                 strOutputFile     )
  38.  
  39.  
  40.     Select Case intOpMode
  41.  
  42.         Case CONST_SHOW_USAGE
  43.             Call ShowUsage()
  44.  
  45.         Case CONST_LIST
  46.             Call NetworkProtocol(strServer,      _
  47.                                  strOutputFile,  _
  48.                                  strUserName,    _
  49.                                  strPassword     )
  50.  
  51.         Case CONST_ERROR
  52.             'Do Nothing
  53.  
  54.         Case Else                    'Default -- should never happen
  55.             Call Wscript.Echo("Error occurred in passing parameters.")
  56.  
  57.     End Select
  58.  
  59. '********************************************************************
  60. '* End of Script
  61. '********************************************************************
  62.  
  63. '********************************************************************
  64. '*
  65. '* Sub NetworkProtocol (strServer, strOutputFile, strUserName, strPassword)
  66. '*
  67. '* Purpose: Displays Network Protocol Information.
  68. '*
  69. '* Input:   strServer           a machine name
  70. '*          strOutputFile       an output file name
  71. '*          strUserName         the current user's name
  72. '*          strPassword         the current user's password
  73. '*
  74. '* Output:  Results are either printed on screen or saved in strOutputFile.
  75. '*
  76. '********************************************************************
  77.  
  78. Private Sub NetworkProtocol (strServer, strOutputFile, strUserName, strPassword)
  79.  
  80.    ON ERROR RESUME NEXT
  81.  
  82.     Dim objFileSystem, objOutputFile, objService, objSet, obj
  83.     Dim strQuery, strMessage, strWBEMClass
  84.     Dim I
  85.  
  86.     strWBEMClass = "Win32_NetworkProtocol"
  87.  
  88.     'Open a text file for output if the file is requested
  89.     If Not IsEmpty(strOutputFile) Then
  90.         If (NOT blnOpenFile(strOutputFile, objOutputFile)) Then
  91.             Call Wscript.Echo ("Could not open an output file.")
  92.             Exit Sub
  93.         End If
  94.     End If
  95.  
  96.     'Establish a connection with the server.
  97.     If blnConnect("root\cimv2", _
  98.                    strUserName, _
  99.                    strPassword, _
  100.                    strServer  , _ 
  101.                    objService ) Then
  102.         Call Wscript.Echo("")
  103.         Call Wscript.Echo("Please check the server name, " _
  104.                         & "credentials and WBEM Core.")
  105.         Exit Sub
  106.     End If
  107.  
  108.     'Get the first instance
  109.     Set objSet = objService.InstancesOf(strWBEMClass )
  110.     If blnErrorOccurred ("obtaining the "& strWBEMClass ) Then Exit Sub
  111.     i = objSet.Count
  112.     If blnErrorOccurred ("counting instances") Then Exit Sub
  113.     If I > 1 then
  114.         WriteLine(vbCRLF & I & " network protocols on machine " _
  115.                  & strServer & ":" & vbCRLF), objOutputFile
  116.         If blnErrorOccurred ("printing instance header") Then Exit Sub
  117.     ElseIf I = 1 then
  118.         WriteLine(vbCRLF & I & " network protocol on machine " _
  119.                  & strServer & ":" & vbCRLF), objOutputFile
  120.         If blnErrorOccurred ("printing instance header") Then Exit Sub
  121.     Else
  122.         WriteLine(vbCRLF & "There is no network protocol data to report.")
  123.         Exit Sub
  124.     End If
  125.     For Each obj In objSet
  126.         Call WriteLine ("Description                   : " & _
  127.                         obj.Description, objOutputFile)
  128.         Call WriteLine ("Name                          : " & _
  129.                    Left(obj.Name, 46), objOutputFile)
  130.         Call WriteLine ("Maximum Message Size          : " & _
  131.                         obj.MaximumMessageSize, objOutputFile)
  132.         Call WriteLine ("Connectionless Service        : " & _
  133.                         obj.ConnectionlessService, objOutputFile)
  134.         Call WriteLine ("Guarantees Delivery           : " & _
  135.                         obj.GuaranteesSequencing, objOutputFile)
  136.         Call WriteLine ("Message Oriented              : " & _
  137.                         obj.MessageOriented, objOutputFile)      
  138.         Call WriteLine ("Pseudo Stream Oriented        : " & _
  139.                         obj.PseudoStreamOriented, objOutputFile)      
  140.         Call WriteLine ("Supports Broadcasting         : " & _
  141.                         obj.SupportsBroadcasting, objOutputFile)      
  142.         Call WriteLine ("Supports Connect Data         : " & _
  143.                         obj.SupportsConnectData, objOutputFile)      
  144.         Call WriteLine ("Supports Disconnect Data      : " & _
  145.                         obj.SupportsDisconnectData, objOutputFile)      
  146.         Call WriteLine ("Supports Encryption           : " & _
  147.                         obj.SupportsEncryption, objOutputFile)      
  148.         Call WriteLine ("Supports Expedited Data       : " & _
  149.                         obj.SupportsExpeditedData, objOutputFile)      
  150.         Call WriteLine ("Supports Fragmentation        : " & _
  151.                         obj.SupportsFragmentation, objOutputFile)      
  152.         Call WriteLine ("Supports Graceful Closing     : " & _
  153.                         obj.SupportsGracefulClosing, objOutputFile)      
  154.         Call WriteLine ("Supports Guaranteed Bandwidth : " & _
  155.                         obj.SupportsGuaranteedBandwidth, objOutputFile)      
  156.         Call WriteLine ("Supports Multicasting         : " & _
  157.                         obj.SupportsMulticasting, objOutputFile)      
  158.         Call WriteLine ("", objOutputFile)
  159.       Next
  160.  
  161.     If IsObject(objOutputFile) Then
  162.         objOutputFile.Close
  163.         Call Wscript.Echo ("Results are saved in file " & strOutputFile & ".")
  164.     End If
  165.  
  166. End Sub
  167.  
  168.  
  169. '********************************************************************
  170. '*
  171. '* Function intParseCmdLine()
  172. '*
  173. '* Purpose: Parses the command line.
  174. '* Input:   
  175. '*
  176. '* Output:  strServer         a remote server ("" = local server")
  177. '*          strUserName       the current user's name
  178. '*          strPassword       the current user's password
  179. '*          strOutputFile     an output file name
  180. '*
  181. '********************************************************************
  182. Private Function intParseCmdLine( ByRef strServer,        _
  183.                                   ByRef strUserName,      _
  184.                                   ByRef strPassword,      _
  185.                                   ByRef strOutputFile     )
  186.  
  187.  
  188.     ON ERROR RESUME NEXT
  189.  
  190.     Dim strFlag
  191.     Dim intState, intArgIter
  192.     Dim objFileSystem
  193.  
  194.     If Wscript.Arguments.Count > 0 Then
  195.         strFlag = Wscript.arguments.Item(0)
  196.     End If
  197.  
  198.     If IsEmpty(strFlag) Then                'No arguments have been received
  199.         intParseCmdLine = CONST_LIST
  200.         Exit Function
  201.     End If
  202.  
  203.     'Check if the user is asking for help or is just confused
  204.     If (strFlag="help") OR (strFlag="/h") OR (strFlag="\h") OR (strFlag="-h") _
  205.         OR (strFlag = "\?") OR (strFlag = "/?") OR (strFlag = "?") _ 
  206.         OR (strFlag="h") Then
  207.         intParseCmdLine = CONST_SHOW_USAGE
  208.         Exit Function
  209.     End If
  210.  
  211.     'Retrieve the command line and set appropriate variables
  212.      intArgIter = 0
  213.     Do While intArgIter <= Wscript.arguments.Count - 1
  214.         Select Case Left(LCase(Wscript.arguments.Item(intArgIter)),2)
  215.   
  216.             Case "/s"
  217.                 If Not blnGetArg("Server", strServer, intArgIter) Then
  218.                     intParseCmdLine = CONST_ERROR
  219.                     Exit Function
  220.                 End If
  221.                 intArgIter = intArgIter + 1
  222.  
  223.             Case "/o"
  224.                 If Not blnGetArg("Output File", strOutputFile, intArgIter) Then
  225.                     intParseCmdLine = CONST_ERROR
  226.                     Exit Function
  227.                 End If
  228.                 intArgIter = intArgIter + 1
  229.  
  230.             Case "/u"
  231.                 If Not blnGetArg("User Name", strUserName, intArgIter) Then
  232.                     intParseCmdLine = CONST_ERROR
  233.                     Exit Function
  234.                 End If
  235.                 intArgIter = intArgIter + 1
  236.  
  237.             Case "/w"
  238.                 If Not blnGetArg("User Password", strPassword, intArgIter) Then
  239.                     intParseCmdLine = CONST_ERROR
  240.                     Exit Function
  241.                 End If
  242.                 intArgIter = intArgIter + 1
  243.  
  244.             Case Else 'We shouldn't get here
  245.                 Call Wscript.Echo("Invalid or misplaced parameter: " _
  246.                    & Wscript.arguments.Item(intArgIter) & vbCRLF _
  247.                    & "Please check the input and try again," & vbCRLF _
  248.                    & "or invoke with '/?' for help with the syntax.")
  249.                 Wscript.Quit
  250.  
  251.         End Select
  252.  
  253.     Loop '** intArgIter <= Wscript.arguments.Count - 1
  254.  
  255.     If IsEmpty(intParseCmdLine) Then _
  256.         intParseCmdLine = CONST_LIST
  257.  
  258. End Function
  259.  
  260. '********************************************************************
  261. '*
  262. '* Sub ShowUsage()
  263. '*
  264. '* Purpose: Shows the correct usage to the user.
  265. '*
  266. '* Input:   None
  267. '*
  268. '* Output:  Help messages are displayed on screen.
  269. '*
  270. '********************************************************************
  271. Sub ShowUsage ()
  272.  
  273.     Wscript.Echo ""
  274.     Wscript.Echo "Displays Network Protocol Information."
  275.     Wscript.Echo ""
  276.     Wscript.Echo "SYNTAX:"
  277.     Wscript.Echo "  NetworkProtocol.vbs [/S <server>] [/U <username>]"
  278.     Wscript.Echo "  [/W <password>] [/O <outputfile>]"
  279.     Wscript.Echo ""
  280.     Wscript.Echo "PARAMETER SPECIFIERS:"
  281.     Wscript.Echo "   server        A machine name."
  282.     Wscript.Echo "   username      The current user's name."
  283.     Wscript.Echo "   password      Password of the current user."
  284.     Wscript.Echo "   outputfile    The output file name."
  285.     Wscript.Echo ""
  286.     Wscript.Echo "EXAMPLE:"
  287.     Wscript.Echo "1. cscript NetworkProtocol.vbs"
  288.     Wscript.Echo "   Display network protocols for the current machine."
  289.     Wscript.Echo "2. cscript NetworkProtocol.vbs /S MyMachine2"
  290.     Wscript.Echo "   Display network protocols for the machine MyMachine2."
  291.  
  292. End Sub
  293.  
  294. '********************************************************************
  295. '* General Routines
  296. '********************************************************************
  297.  
  298. '********************************************************************
  299. '*
  300. '* Function strPackString()
  301. '*
  302. '* Purpose: Attaches spaces to a string to increase the length to intWidth.
  303. '*
  304. '* Input:   strString   a string
  305. '*          intWidth    the intended length of the string
  306. '*          blnAfter    Should spaces be added after the string?
  307. '*          blnTruncate specifies whether to truncate the string or not if
  308. '*                      the string length is longer than intWidth
  309. '*
  310. '* Output:  strPackString is returned as the packed string.
  311. '*
  312. '********************************************************************
  313. Private Function strPackString( ByVal strString, _
  314.                                 ByVal intWidth,  _
  315.                                 ByVal blnAfter,  _
  316.                                 ByVal blnTruncate)
  317.  
  318.     ON ERROR RESUME NEXT
  319.  
  320.     intWidth      = CInt(intWidth)
  321.     blnAfter      = CBool(blnAfter)
  322.     blnTruncate   = CBool(blnTruncate)
  323.  
  324.     If Err.Number Then
  325.         Call Wscript.Echo ("Argument type is incorrect!")
  326.         Err.Clear
  327.         Wscript.Quit
  328.     End If
  329.  
  330.     If IsNull(strString) Then
  331.         strPackString = "null" & Space(intWidth-4)
  332.         Exit Function
  333.     End If
  334.  
  335.     strString = CStr(strString)
  336.     If Err.Number Then
  337.         Call Wscript.Echo ("Argument type is incorrect!")
  338.         Err.Clear
  339.         Wscript.Quit
  340.     End If
  341.  
  342.     If intWidth > Len(strString) Then
  343.         If blnAfter Then
  344.             strPackString = strString & Space(intWidth-Len(strString))
  345.         Else
  346.             strPackString = Space(intWidth-Len(strString)) & strString & " "
  347.         End If
  348.     Else
  349.         If blnTruncate Then
  350.             strPackString = Left(strString, intWidth-1) & " "
  351.         Else
  352.             strPackString = strString & " "
  353.         End If
  354.     End If
  355.  
  356. End Function
  357.  
  358. '********************************************************************
  359. '* 
  360. '*  Function blnGetArg()
  361. '*
  362. '*  Purpose: Helper to intParseCmdLine()
  363. '* 
  364. '*  Usage:
  365. '*
  366. '*     Case "/s" 
  367. '*       blnGetArg ("server name", strServer, intArgIter)
  368. '*
  369. '********************************************************************
  370. Private Function blnGetArg ( ByVal StrVarName,   _
  371.                              ByRef strVar,       _
  372.                              ByRef intArgIter) 
  373.  
  374.     blnGetArg = False 'failure, changed to True upon successful completion
  375.  
  376.     If Len(Wscript.Arguments(intArgIter)) > 2 then
  377.         If Mid(Wscript.Arguments(intArgIter),3,1) = ":" then
  378.             If Len(Wscript.Arguments(intArgIter)) > 3 then
  379.                 strVar = Right(Wscript.Arguments(intArgIter), _
  380.                          Len(Wscript.Arguments(intArgIter)) - 3)
  381.                 blnGetArg = True
  382.                 Exit Function
  383.             Else
  384.                 intArgIter = intArgIter + 1
  385.                 If intArgIter > (Wscript.Arguments.Count - 1) Then
  386.                     Call Wscript.Echo( "Invalid " & StrVarName & ".")
  387.                     Call Wscript.Echo( "Please check the input and try again.")
  388.                     Exit Function
  389.                 End If
  390.  
  391.                 strVar = Wscript.Arguments.Item(intArgIter)
  392.                 If Err.Number Then
  393.                     Call Wscript.Echo( "Invalid " & StrVarName & ".")
  394.                     Call Wscript.Echo( "Please check the input and try again.")
  395.                     Exit Function
  396.                 End If
  397.  
  398.                 If InStr(strVar, "/") Then
  399.                     Call Wscript.Echo( "Invalid " & StrVarName)
  400.                     Call Wscript.Echo( "Please check the input and try again.")
  401.                     Exit Function
  402.                 End If
  403.  
  404.                 blnGetArg = True 'success
  405.             End If
  406.         Else
  407.             strVar = Right(Wscript.Arguments(intArgIter), _
  408.                      Len(Wscript.Arguments(intArgIter)) - 2)
  409.             blnGetArg = True 'success
  410.             Exit Function
  411.         End If
  412.     Else
  413.         intArgIter = intArgIter + 1
  414.         If intArgIter > (Wscript.Arguments.Count - 1) Then
  415.             Call Wscript.Echo( "Invalid " & StrVarName & ".")
  416.             Call Wscript.Echo( "Please check the input and try again.")
  417.             Exit Function
  418.         End If
  419.  
  420.         strVar = Wscript.Arguments.Item(intArgIter)
  421.         If Err.Number Then
  422.             Call Wscript.Echo( "Invalid " & StrVarName & ".")
  423.             Call Wscript.Echo( "Please check the input and try again.")
  424.             Exit Function
  425.         End If
  426.  
  427.         If InStr(strVar, "/") Then
  428.             Call Wscript.Echo( "Invalid " & StrVarName)
  429.             Call Wscript.Echo( "Please check the input and try again.")
  430.             Exit Function
  431.         End If
  432.         blnGetArg = True 'success
  433.     End If
  434. End Function
  435.  
  436. '********************************************************************
  437. '*
  438. '* Function blnConnect()
  439. '*
  440. '* Purpose: Connects to machine strServer.
  441. '*
  442. '* Input:   strServer       a machine name
  443. '*          strNameSpace    a namespace
  444. '*          strUserName     name of the current user
  445. '*          strPassword     password of the current user
  446. '*
  447. '* Output:  objService is returned  as a service object.
  448. '*          strServer is set to local host if left unspecified
  449. '*
  450. '********************************************************************
  451. Private Function blnConnect(ByVal strNameSpace, _
  452.                             ByVal strUserName,  _
  453.                             ByVal strPassword,  _
  454.                             ByRef strServer,    _
  455.                             ByRef objService)
  456.  
  457.     ON ERROR RESUME NEXT
  458.  
  459.     Dim objLocator, objWshNet
  460.  
  461.     blnConnect = False     'There is no error.
  462.  
  463.     'Create Locator object to connect to remote CIM object manager
  464.     Set objLocator = CreateObject("WbemScripting.SWbemLocator")
  465.     If Err.Number then
  466.         Call Wscript.Echo( "Error 0x" & CStr(Hex(Err.Number)) & _
  467.                            " occurred in creating a locator object." )
  468.         If Err.Description <> "" Then
  469.             Call Wscript.Echo( "Error description: " & Err.Description & "." )
  470.         End If
  471.         Err.Clear
  472.         blnConnect = True     'An error occurred
  473.         Exit Function
  474.     End If
  475.  
  476.     'Connect to the namespace which is either local or remote
  477.     Set objService = objLocator.ConnectServer (strServer, strNameSpace, _
  478.        strUserName, strPassword)
  479.     ObjService.Security_.impersonationlevel = 3
  480.     If Err.Number then
  481.         Call Wscript.Echo( "Error 0x" & CStr(Hex(Err.Number)) & _
  482.                            " occurred in connecting to server " _
  483.            & strServer & ".")
  484.         If Err.Description <> "" Then
  485.             Call Wscript.Echo( "Error description: " & Err.Description & "." )
  486.         End If
  487.         Err.Clear
  488.         blnConnect = True     'An error occurred
  489.     End If
  490.  
  491.     'Get the current server's name if left unspecified
  492.     If IsEmpty(strServer) Then
  493.         Set objWshNet = CreateObject("Wscript.Network")
  494.     strServer     = objWshNet.ComputerName
  495.     End If
  496.  
  497. End Function
  498.  
  499. '********************************************************************
  500. '*
  501. '* Sub      VerifyHostIsCscript()
  502. '*
  503. '* Purpose: Determines which program is used to run this script.
  504. '*
  505. '* Input:   None
  506. '*
  507. '* Output:  If host is not cscript, then an error message is printed 
  508. '*          and the script is aborted.
  509. '*
  510. '********************************************************************
  511. Sub VerifyHostIsCscript()
  512.  
  513.     ON ERROR RESUME NEXT
  514.  
  515.     Dim strFullName, strCommand, i, j, intStatus
  516.  
  517.     strFullName = WScript.FullName
  518.  
  519.     If Err.Number then
  520.         Call Wscript.Echo( "Error 0x" & CStr(Hex(Err.Number)) & " occurred." )
  521.         If Err.Description <> "" Then
  522.             Call Wscript.Echo( "Error description: " & Err.Description & "." )
  523.         End If
  524.         intStatus =  CONST_ERROR
  525.     End If
  526.  
  527.     i = InStr(1, strFullName, ".exe", 1)
  528.     If i = 0 Then
  529.         intStatus =  CONST_ERROR
  530.     Else
  531.         j = InStrRev(strFullName, "\", i, 1)
  532.         If j = 0 Then
  533.             intStatus =  CONST_ERROR
  534.         Else
  535.             strCommand = Mid(strFullName, j+1, i-j-1)
  536.             Select Case LCase(strCommand)
  537.                 Case "cscript"
  538.                     intStatus = CONST_CSCRIPT
  539.                 Case "wscript"
  540.                     intStatus = CONST_WSCRIPT
  541.                 Case Else       'should never happen
  542.                     Call Wscript.Echo( "An unexpected program was used to " _
  543.                                        & "run this script." )
  544.                     Call Wscript.Echo( "Only CScript.Exe or WScript.Exe can " _
  545.                                        & "be used to run this script." )
  546.                     intStatus = CONST_ERROR
  547.                 End Select
  548.         End If
  549.     End If
  550.  
  551.     If intStatus <> CONST_CSCRIPT Then
  552.         Call WScript.Echo( "Please run this script using CScript." & vbCRLF & _
  553.              "This can be achieved by" & vbCRLF & _
  554.              "1. Using ""CScript NetworkProtocol.vbs arguments"" for Windows 95/98 or" _
  555.              & vbCRLF & "2. Changing the default Windows Scripting Host " _
  556.              & "setting to CScript" & vbCRLF & "    using ""CScript " _
  557.              & "//H:CScript //S"" and running the script using" & vbCRLF & _
  558.              "    ""NetworkProtocol.vbs arguments"" for Windows NT/2000." )
  559.         WScript.Quit
  560.     End If
  561.  
  562. End Sub
  563.  
  564. '********************************************************************
  565. '*
  566. '* Sub WriteLine()
  567. '* Purpose: Writes a text line either to a file or on screen.
  568. '* Input:   strMessage  the string to print
  569. '*          objFile     an output file object
  570. '* Output:  strMessage is either displayed on screen or written to a file.
  571. '*
  572. '********************************************************************
  573. Sub WriteLine(ByVal strMessage, ByVal objFile)
  574.  
  575.     On Error Resume Next
  576.     If IsObject(objFile) then        'objFile should be a file object
  577.         objFile.WriteLine strMessage
  578.     Else
  579.         Call Wscript.Echo( strMessage )
  580.     End If
  581.  
  582. End Sub
  583.  
  584. '********************************************************************
  585. '* 
  586. '* Function blnErrorOccurred()
  587. '*
  588. '* Purpose: Reports error with a string saying what the error occurred in.
  589. '*
  590. '* Input:   strIn        string saying what the error occurred in.
  591. '*
  592. '* Output:  displayed on screen 
  593. '* 
  594. '********************************************************************
  595. Private Function blnErrorOccurred (ByVal strIn)
  596.  
  597.     If Err.Number Then
  598.         Call Wscript.Echo( "Error 0x" & CStr(Hex(Err.Number)) & ": " & strIn)
  599.         If Err.Description <> "" Then
  600.             Call Wscript.Echo( "Error description: " & Err.Description)
  601.         End If
  602.         Err.Clear
  603.         blnErrorOccurred = True
  604.     Else
  605.         blnErrorOccurred = False
  606.     End If
  607.  
  608. End Function
  609.  
  610. '********************************************************************
  611. '* 
  612. '* Function blnOpenFile
  613. '*
  614. '* Purpose: Opens a file.
  615. '*
  616. '* Input:   strFileName        A string with the name of the file.
  617. '*
  618. '* Output:  Sets objOpenFile to a FileSystemObject and setis it to 
  619. '*            Nothing upon Failure.
  620. '* 
  621. '********************************************************************
  622. Private Function blnOpenFile(ByVal strFileName, ByRef objOpenFile)
  623.  
  624.     ON ERROR RESUME NEXT
  625.  
  626.     Dim objFileSystem
  627.  
  628.     Set objFileSystem = Nothing
  629.  
  630.     If IsEmpty(strFileName) OR strFileName = "" Then
  631.         blnOpenFile = False
  632.         Set objOpenFile = Nothing
  633.         Exit Function
  634.     End If
  635.  
  636.     'Create a file object
  637.     Set objFileSystem = CreateObject("Scripting.FileSystemObject")
  638.     If blnErrorOccurred("Could not create filesystem object.") Then
  639.         blnOpenFile = False
  640.         Set objOpenFile = Nothing
  641.         Exit Function
  642.     End If
  643.  
  644.     'Open the file for output
  645.     Set objOpenFile = objFileSystem.OpenTextFile(strFileName, 8, True)
  646.     If blnErrorOccurred("Could not open") Then
  647.         blnOpenFile = False
  648.         Set objOpenFile = Nothing
  649.         Exit Function
  650.     End If
  651.     blnOpenFile = True
  652.  
  653. End Function
  654.  
  655. '********************************************************************
  656. '*                                                                  *
  657. '*                           End of File                            *
  658. '*                                                                  *
  659. '********************************************************************
  660.