• VBScript reference

    Author
    Topic
    #352134

    Been trying to use VBScript in connection with the Windows Scripting Host as a batch language. Little vbs files that do things little things for you locally (not as a web language). Here’s a useful example that I use to maintian a listserv that I moderate. It opens the local text files containing the addresses, and loads the list maintanence page in my browser. You can modify it to open certain reports in word and spreadsheets in excel that you use together:

    Set objShell = CreateObject("WScript.Shell")
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    
    RunFile "E:htmlIN_PROGardceGroups_ardc_committee_Members.URL"
    RunFile "E:htmlIN_PROGardccommittee.email-only.txt"
    RunFile "E:htmlIN_PROGardccommittee.list.txt"
    RunFile "E:htmlIN_PROGardcdemocrats.email-only.txt"
    RunFile "E:htmlIN_PROGardcdemocrats.list.txt"
    
    Set objShell = Nothing
    Set objFSO = Nothing
    
    Sub RunFile(strFile)
      If objFSO.FileExists(strFile) Then
       objShell.Run Chr(34) & strFile & Chr(34)
      Else
       objShell.Popup Chr(39) & objFSO.GetFileName(strFile) & _
         Chr(39) & vbCr & "could not be found!", 3, _
         "Maintenance Session Error", 48
      End If
    End Sub

    I’ve tried to leverage my knowledge of VBA, but a lot of the syntax is different. Is there a VBS help file or a downloadable quick reference?

    Viewing 0 reply threads
    Author
    Replies
    • #515895

      There’s also VBScript in a Nutshell by Paul Lomax published by O’Reilly.

      I’m recently reading a book published by Wrox about the WSH that goes into great detail about the capabilities of the WSH.

      I’ve been able to do some neat things using WSH & VBScript.

      Mike

      • #515955

        Okay, I like Lomax’s nutshells on VBA and VBScript, but I find it sad that typos in the VB&VBA (1998) were not corrected in the VBS (2000). Example: the reference to the Filter function in the discussion of using Split; sloppy copy/paste/edit. Still, compared with the official doc, the books are a godsend.

    Viewing 0 reply threads
    Reply To: VBScript reference

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: