#1 11 Mar 2010 17:07

Phillip Geurtz
Member
Registered: 11 Mar 2010
Posts: 3

Excellent tool

This site has become the first stop I make when I want script up some little bit of code. Invaluable VBscript resource. I like the most recent layout refresh in the VBscript section.

The only thing I think that is lacking is defining what some functions, methods, or properties return as a result.

from FileSystemObject

.GetAbsolutePathName(strPath) - Returns a string with the full drive, path, and file names. Drive:\Path\To\File.Ext
.GetBaseName(strPath) - Returns a string with the file name, without the extension. File
.GetDrive(strDrive) - Returns an object referring to a drive.
.GetDriveName(strDrive) - Returns a string referring to a drive. Drive:
.GetExtensionName(strPath) - Returns a string referring to the extension of the file. Ext
.GetFile(strPath) - Returns an object referring to a file.
.GetFileName(strPath) - Returns a string referring to a file. File.Ext
.GetFolder(strPath) - Returns an object referring to the path.
.GetParentFolderName(strPath) - Returns a string referring to the path. \Path\To\

Perhaps adding to or expanding the info on other automation objects. For example, I'd like to see all, or the most commonly used methods and properties for the Shell object (.BrowseForFolder and other methods are sorely lacking when comparing to the FileSystemObject documentation). It took me forever to figure out how to work with Word.Application or InternetExplorer.Application to access the contents of the clipboard.

'Read the clipboard
'First try Word
On Error Resume Next
strClip = ""
Set objWord = WScript.CreateObject("Word.Application")
If Err = 0 Then
    With objWord
        .Visible = False
        .Documents.Add
        .Selection.Paste
        .Selection.WholeStory
        strClip = Left(.Selection,Len(.Selection) - 1)
        .Quit False
    End With
End If

'Second try Internet Explorer
If Len(strClip) = 0 Then
    Set objIE = WScript.CreateObject("InternetExplorer.Application")
    If Err = 0 Then
        With objIE
            .Navigate("about:blank")
            strClip = .document.parentwindow.clipboardData.GetData("text")
            .Quit
        End With
    End If
End If
On Error GoTo 0

Offline

#2 11 Mar 2010 23:01

Simon Sheppard
Super Administrator
Registered: 27 Aug 2005
Posts: 998
Website

Re: Excellent tool

Thanks for the useful feedback - I've edited the FileSystemObject page and will look into those other objects & properties.

Online

Board footer

Powered by FluxBB