Go Back   Computer Forums > General Computing > Programming
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 09-19-2005, 10:13 PM   #1
Baseband Member
 
Join Date: Jul 2004
Posts: 23
Default What are the full functional extents of VBScript...?

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.
__________________

cybershark5886 is offline   Reply With Quote
Old 09-20-2005, 06:25 AM   #2
Site Team
 
root's Avatar
 
Join Date: Mar 2004
Posts: 8,004
Default Re: What are the full functional extents of VBScript...?

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/de...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.
__________________

__________________
I didn’t fight my way to the top of the food chain to be a vegetarian…
Im sick of people saying 'dont waste paper'. If trees wanted to live, they'd all carry guns.
"The inherent vice of capitalism is the unequal sharing of blessings; The inherent vice of socialism is the equal sharing of miseries."
root is offline   Reply With Quote
Old 09-23-2005, 12:57 AM   #3
Baseband Member
 
Join Date: Jul 2004
Posts: 23
Default

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?
cybershark5886 is offline   Reply With Quote
Old 09-23-2005, 06:10 AM   #4
Site Team
 
root's Avatar
 
Join Date: Mar 2004
Posts: 8,004
Default Re: What are the full functional extents of VBScript...?

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
__________________
I didn’t fight my way to the top of the food chain to be a vegetarian…
Im sick of people saying 'dont waste paper'. If trees wanted to live, they'd all carry guns.
"The inherent vice of capitalism is the unequal sharing of blessings; The inherent vice of socialism is the equal sharing of miseries."
root is offline   Reply With Quote
Old 09-23-2005, 01:36 PM   #5
Baseband Member
 
Join Date: Jul 2004
Posts: 23
Default

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?
cybershark5886 is offline   Reply With Quote
Old 09-26-2005, 12:10 PM   #6
Site Team
 
root's Avatar
 
Join Date: Mar 2004
Posts: 8,004
Default Re: What are the full functional extents of VBScript...?

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!!
__________________
I didn’t fight my way to the top of the food chain to be a vegetarian…
Im sick of people saying 'dont waste paper'. If trees wanted to live, they'd all carry guns.
"The inherent vice of capitalism is the unequal sharing of blessings; The inherent vice of socialism is the equal sharing of miseries."
root is offline   Reply With Quote
Old 10-08-2005, 12:54 PM   #7
Baseband Member
 
Join Date: Jul 2004
Posts: 23
Default

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.
__________________

cybershark5886 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is 05:45 AM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0