Re: Thank you Richard, Paul and urkec



Thanks Paul. I can see there is an incredible amount to be learned!

Jeremy

"Paul Randall" <paulr901@xxxxxxxxxxxx> wrote in message
news:%23BaAIizIHHA.4112@xxxxxxxxxxxxxxxxxxxxxxx
Hi, Jeremy
VBScript is a programming language that can do math, manipulate strings,
but can't interact much with the real world. You create a text file with
the scripts instructions and tell CScript or WScript to execute it. The
only built-in way to communicate with the person running the script is
through a few statements like:
Dim Input
Input = InputBox("Enter your name")
MsgBox ("You entered: " & Input)

It can use COM objects, if they need no license or if they are licensed
for scripting use on your computer. Microsoft provides a wealth of COM
object with various purposes. Finding out what objects are available on
your computer is difficult; finding out how to use them is more difficult.
An object browser can help you learn how to use the objects. You
typically select an object, and it will give you a list of the properties
and methods and events associated with the object and tell you the data
required or returned by the properties, methods and events.

For example, the file system object is used to read and write text files.
It is documented in the VBScript help file Script56.chm. It has lots of
properties and methods, but no events.

You can use the ADO and ADOX objects to analyze and manipulate an existing
Access-compatible database and even create them. Go to msdn.microsoft.com
and search for Microsoft Active X Data Objects for documentation.

You can use the InternetExplorer.Application object to programmatically
open a web browser, navigate to various URLs, manipulate the HTML of the
web page, thus changing what is displayed, extract information, click
options, check boxes, submit buttons, etc. You can associate subroutines
you write with events that occur in the IE window, such as intercept, look
at and modify the data submitted when you click a submit button Search
MSDN for "HTML and DHTML Reference" to get the documentation.

From within some applications in the Microsoft Office suite, you can
access its object browser. I think even the Microsoft Word package
includes an object browser to help those who script its VBA (like a
VBScript but also has functions for interacting with and manipulating the
Word object model.

One very good free object browser is TLViewer, available at
http://www.tlviewer.org/tlviewer/index.htm, Note that you need a certain
version or higher, of Tlbinf32.dll, as well as the VB6 run times (which
you may already have). Note also that each time you run TLViewer, it
searches your system and creates a file named dbPID.dat which contain a
list of hopefully all objects on your system, although not all are
scriptable or licensed for scripting on your system. My system has over
3000 entries in this file. Most people just use the TLViewer graphic
interface to search for program IDs, such as InternetExplorer to get info
on the object of interest, but some of us like to look under the hood and
see what all is available.

-Paul Randall

"Jeremy Schubert" <jschubert@no*spam.shaw.ca> wrote in message
news:O5Mb$9wIHHA.4760@xxxxxxxxxxxxxxxxxxxxxxx
Richard - Thanks for the sites. I will check them out this week as time
allows. But just to clarify in the meantime, VBScript, WSH, ADSI, ADO,
WMI are technically each their own entities? If you were trying to
explain this to others, would you say that WSH, ADSI, ADO, WMI are all
possible components of vbscript?

Paul - Your search term revealed a lot of interesting sites that I will
check out as time permits this week. What is an object browser?

urkec - subfldr did the trick. For now I'm just using the writeline
function to enter the data into a txt file that I massage with Excel. My
next task is to learn how to post the info into an Excel *** rather
then just a file.

"Jeremy Schubert" <jschubert@no*spam.shaw.ca> wrote in message
news:O1b6YCUIHHA.1912@xxxxxxxxxxxxxxxxxxxxxxx
Please cut me some slack while I try to figure/sort this all out. I've
been dabling in vbscript for a while now but I'm sure most of you know
more then I'll ever forget or however that saying goes (pardon the
dramatics).

I'm trying to create a script that will read the folder properties of
the sub directories in the Users, Departmental, Redirected and Profiles
shares on my server (see my initial code below). Essentially, I want to
know the paths to the folders, dates created, last modified and accessed
and what size they are. I know out some point I'll have to create some
kind of loop and I think I'm confortable with figuring that out. But I
do have three questions if anyone has time.

1. Right now I'm thinking the best thing to do will be to redirect a
dir cmd of each folder to a text file and have my script use that file
to figure out the paths to the sub directories. Is there another way I
could do this such as a command that would say, 'for each sub folder of
the Users folder...' (but only going down one level.

2. In my line Call Show(wscript.Name & "," & wscript.ParentFolder &
","& wscript.Path & "," & wscript.Size & "," & wscript.DateCreated & ","
& wscript.DateLastModified & "," & wscript.DateLastAccessed) I get error
messages saying that not all my wscript.xxx properties are recognized.
Can someone please point me to a web page that lists the possible
properties?

3. What is the best source to learn the difference between wscript,
cscript, wsh and all the other acronyms ('sub types of vbs???) that
seem to belong to vbs? A certain book and or website? Should a basic
Microsoft or Sybex book for example cover these topics?

Thanks,
Jeremy

CODE
----------------------------

'Jeremy Schubert
'folderaudit.vbs
'Determines path, parent folder, creation date, last accessed and
modified dates, and size of the Users folders
'on the Bishop Grandin High School Admin Server

L_Welcome_MsgBox_Message_Text = "This script will display the property
attributes for the User Folders on the BGHS Admin Server
(S047-A0371-01)."
L_Welcome_MsgBox_Title_Text = "Folder Size"
Call Welcome()


Dim objXL

Set objXL = WScript.CreateObject("Excel.Application")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder("i:\users")

objXL.Visible = TRUE

objXL.WorkBooks.Add

objXL.Columns(1).ColumnWidth = 20
objXL.Columns(2).ColumnWidth = 30
objXL.Columns(3).ColumnWidth = 40
objXL.Columns(4).ColumnWidth = 50
objXL.Columns(5).ColumnWidth = 60
objXL.Columns(6).ColumnWidth = 70
objXL.Columns(7).ColumnWidth = 80


objXL.Cells(1, 1).Value = "Folder Name"
objXL.Cells(1, 2).Value = "Parent Folder"
objXL.Cells(1, 3).Value = "Folder Path"
objXL.Cells(1, 4).Value = "Folder Size"
objXL.Cells(1, 5).Value = "Date Created"
objXL.Cells(1, 6).Value = "Date Last Accessed"
objXL.Cells(1, 7).Value = "Date Last Modified"

objXL.Range("A1:G1").Select
objXL.Selection.Font.Bold = True
objXL.Selection.Interior.ColorIndex = 1
objXL.Selection.Interior.Pattern = 1 'xlSolid
objXL.Selection.Font.ColorIndex = 2

objXL.Columns("B:B").Select
objXL.Selection.HorizontalAlignment = &hFFFFEFDD ' xlLeft

Dim intIndex
intIndex = 2

Sub Show(strName, strValue, strDesc)
objXL.Cells(intIndex, 1).Value = strName
objXL.Cells(intIndex, 2).Value = strValue
objXL.Cells(intIndex, 3).Value = strDesc
intIndex = intIndex + 1
objXL.Cells(intIndex, 1).Select
End Sub

'
' Show WScript properties

Call Show(wscript.Name & "," & wscript.ParentFolder & ","& wscript.Path
& "," & wscript.Size & "," & wscript.DateCreated & "," &
wscript.DateLastModified & "," & wscript.DateLastAccessed)

' Show command line arguments.
'
Dim colArgs
Set colArgs = WScript.Arguments
Call Show("Arguments.Count", colArgs.Count, "Number of command line
arguments")

For i = 0 to colArgs.Count - 1
objXL.Cells(intIndex, 1).Value = "Arguments(" & i & ")"
objXL.Cells(intIndex, 2).Value = colArgs(i)
intIndex = intIndex + 1
objXL.Cells(intIndex, 1).Select
Next



' ********************
' *
' * Welcome
' *
Sub Welcome()
Dim intDoIt

intDoIt = MsgBox(L_Welcome_MsgBox_Message_Text, _
vbOKCancel + vbInformation, _
L_Welcome_MsgBox_Title_Text )
If intDoIt = vbCancel Then
WScript.Quit
End If
End Sub








.