What are the full functional extents of VBScript...?

cybershark5886

Baseband Member
Messages
24
I would like to know how much you can really do with VBScript since it is only a CLI type interface as compared to the full funtionality of Visual Basic.

As far as I know the most advanced function that it has is access to registry. And the most limited part of it is that it cannot create forms (although it can create message boxes).

That's about all I know about it's features. What are some of the more advanced things that you can do with VBS and what are its biggest limitations? I'd appreciate any help.
 
VB script has access to all sorts of things,
The file system,
it can open the CD drive.
calculate variables, and write values in forms.

It works in the same way as javascript does for updating elements.
document.form.element.caption = variable

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnanchor/html/scriptinga.asp


that might help you a little...
it's a better idea to use Javascript though, as...
vbscript is only suported on MSplatorms that have a vb interperetor.
vbscript is blocked by most browsers.
including IE6 on xpsp2 (blocks most scripts)...

VB scripts just arn't trusted.
 
Thanks for replying. But could you elaborate on that file system part? Do you mean that it can create an opencommondialog box that displays certain files on your HDD for opening/saving or maybe even that it can read and write information to you HDD?
 
Yes,
well kind of...


here's a start at least...

notepad.vbs
Code:
Set oShell = CreateObject("wscript.shell")

Set oFso = CreateObject("Scripting.FileSystemObject")
If oFSO.FileExists("C:\test.txt") Then
     oShell.Run("C:\test.txt")
Else
     oShell.Run("notepad.exe")
End If
 
Cool. Thanks. This is a little foreign to me at first glance. So, are you setting oShell and oFSO as variables and assigning objects to them? Like, they're not reserved system commands, and I could name it oCybersharkShell and oCybersharkFSO if I wanted to?

Oh, and assuming that is the case, does the line If oFSO.FileExists("C:\test.txt") Then, kinda inadvertently create the file in the process of checking on it or does the file actually have to be made ahead of time?

I only ask this because I have seen some programming languages in which you don't have to make a clear declaration of the creation of an object, but you can somehow create the object in the middle of a conditional statement by seting a variable equal to the value of the object, and then create it by referencing some attribute of the object (although not created yet). But once it runs across the variable in the formula it somehow creates the non-existant object in the process of checking some attribute of it. This is why I said "inadvertantly" because it seems like it shouldn't be able to be done, but if it did work it should be an accidental by-product IMO. It just seemed a little counter intuitive to me. Do you have any idea of what I'm talking about?

Any ways, I may have unecessarily complicated that issue. Maybe it's just litteraly checking the file to see if it has been made ahead of time. Am I right?
 
no, that script doesn't create a file, it just opens it if it is there...

the variable names, are inconsiquential.
the only reason I chose those name was because the oshell runs shell commands, likeoshell.open
and the oFso looks at the file system objects... so it made sense for the examlpe... but call them what you like!!
 
no, that script doesn't create a file, it just opens it if it is there...

the variable names, are inconsiquential.
the only reason I chose those name was because the oshell runs shell commands, likeoshell.open
and the oFso looks at the file system objects... so it made sense for the examlpe... but call them what you like!!


Thank you for the clarification. You've been very helpful. Danke Shon.
 
Back
Top Bottom