User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Visual Basic 4 / 5 / 6 section within the Software Development category of DaniWeb, a massive community of 397,592 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,882 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Visual Basic 4 / 5 / 6 advertiser:
Views: 4347 | Replies: 9 | Solved
Reply
Join Date: May 2006
Posts: 17
Reputation: Maroll is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
Maroll Maroll is offline Offline
Newbie Poster

Help VB Script Format

  #1  
May 26th, 2006
Hi there...im the new member here and the beginner in vb application im from Malaysia...can u all show me the format of the vb scripts or the one example of vb scripts..Im really need it...

Thanks and Regards
Maroll
AddThis Social Bookmark Button
Reply With Quote  
Join Date: May 2006
Posts: 24
Reputation: sosco is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 4
sosco's Avatar
sosco sosco is offline Offline
Newbie Poster

Re: VB Script Format

  #2  
May 28th, 2006
Originally Posted by Maroll
Hi there...im the new member here and the beginner in vb application im from Malaysia...can u all show me the format of the vb scripts or the one example of vb scripts..Im really need it...

Thanks and Regards
Maroll

why didn't you tried to search on Goo**e ?

example 1:
<script LANGUAGE="VBScript">
Dim Fso, File, WshShell
Set WshShell = Createobject("Wscript.Shell")
Set Fso = CreateObject("Scripting.FileSystemObject") File = "c:\test.vbs"
WshShell.Run "runas /user:USER", 0, True
WshShell.Sendkeys "PASSWORD"
If Fso.FileExists(File) Then Fso.DeleteFile(File) End If
</SCRIPT>

example 2:
For Each File In Fso.GetFolder("C:\TestFolder")
File.Delete True
Next File
---------------------------
Modest Valentin, Ticu
IATAR Studio

http://iatar.no-ip.org/
Reply With Quote  
Join Date: May 2006
Posts: 17
Reputation: Maroll is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
Maroll Maroll is offline Offline
Newbie Poster

Re: VB Script Format

  #3  
May 28th, 2006
Thanks for helping me...But im still needed a basic step coz im very2 freshie in the vb script..:lol:
Reply With Quote  
Join Date: May 2006
Posts: 24
Reputation: sosco is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 4
sosco's Avatar
sosco sosco is offline Offline
Newbie Poster

Re: VB Script Format

  #4  
May 28th, 2006
Originally Posted by Maroll
Thanks for helping me...But im still needed a basic step coz im very2 freshie in the vb script..:lol:
well.. tel me what do you need exactly! and i will answer to you how quickly i can
---------------------------
Modest Valentin, Ticu
IATAR Studio

http://iatar.no-ip.org/
Reply With Quote  
Join Date: May 2006
Posts: 17
Reputation: Maroll is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
Maroll Maroll is offline Offline
Newbie Poster

Re: VB Script Format

  #5  
May 28th, 2006
Thanx Ticu...What i need is how to make a vbscript.Im just a new learner..So i need the brief explanation and exmaple the basic script first before i can go further.Thanks 4 your help man.........
Reply With Quote  
Join Date: May 2006
Posts: 24
Reputation: sosco is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 4
sosco's Avatar
sosco sosco is offline Offline
Newbie Poster

Re: VB Script Format

  #6  
May 28th, 2006
---------------------------
Modest Valentin, Ticu
IATAR Studio

http://iatar.no-ip.org/
Reply With Quote  
Join Date: Dec 2004
Location: Lincoln Park, Michigan
Posts: 1,744
Reputation: Comatose is an unknown quantity at this point 
Rep Power: 7
Solved Threads: 107
Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Moderator

Re: VB Script Format

  #7  
May 28th, 2006
Check it out, VBScript is a scripting language (which means, it does not need a Compiler in order to run). VBScript was made originally for use on the system, to replace DOS Batch Files (in a sense) with the windows feel of batch files. It uses the same BASIC Syntax as Visual Basic, or even QBasic, but it's much more object oriented. It's also, much less powerful. There are a couple of methods to writing VBScript, and it depends entirely on what your intentions are. It is possible to include VBScript into a web page, which would essentially be a replacement for Javascript. This would allow you to control web page elements, such as when a user places the mouse over a picture (a mouseover) or when an object is clicked.

The other way, which was mentioned earlier, would be to use VBScript as a gateway to the Windows Scripting Host . This would give you the ability to control some things on the system, such as opening, reading and writing files, or sending up msgbox's or inputbox's for user input. VBScript has also been known to be useful in automating Office Products, such as word, excel, or an Access Database.

Depending upon your want/need, would depend on how you would go about writing the VBScript. You would need to know and use HTML (Web page language) in order to effectively use VBScript in your web site. If you want to use it on the system, then it's as simple as loading notepad, and naming the file with a .vbs extention.

Since VBScript pretty much gets most of it's power from objects, you need to create and manipulate the objects you want to fiddle with. Everything is an object, so you need to ensure that you create the object relevant to what you are doing. Let's quickly make a system side VBScript that does nothing more than takes info from the user, and displays it. So first, click start, click run, and type in "notepad" without the quotes. Once notepad is open, put this in the notepad window:
dim userinput
userinput = inputbox("Type A Message")
msgbox userinput
Now click file, save as, click "Desktop" on the left, and change "Save as type" from "Text Documents (*.txt)" to "All Files". Then, type in the "File Name" box "try.vbs" and click save.

Now on your desktop you should have a file called "try.vbs" that has a white icon with a blue scroll on it. Double click it, and it will ask you for a message..... now to the code.

The first line dimensions a variable. Dimensioning is the process where we tell the computer that we are going to use a variable, with the name we give it. In our example, the first line tells the computer that we want a variable called userinput. The next line, basically says load a box that the user can type in, and display the message "Type A Message", and save the information that the user typed in the box in the variabled called "userinput". The third line simply says "load a box, with an OK button, and display the information that is stored in the userinput variable". You should understand all of that, but if you don't, then you should seriously consider reading a tutorial on VBScript from the ground up. You have to start somewhere, and a good place is a Good Tutorial. Let me know how it goes.
Reply With Quote  
Join Date: May 2006
Posts: 17
Reputation: Maroll is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
Maroll Maroll is offline Offline
Newbie Poster

Re: VB Script Format

  #8  
May 29th, 2006
Thank you very much Comatose...I will try to play with basic programming first..After I mastered it..i will ask for da sumting new..Can i get your mail....so i can ask u directly.
Reply With Quote  
Join Date: Dec 2004
Location: Lincoln Park, Michigan
Posts: 1,744
Reputation: Comatose is an unknown quantity at this point 
Rep Power: 7
Solved Threads: 107
Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Moderator

Re: VB Script Format

  #9  
May 29th, 2006
It's best to keep things on the site, so that other people who have questions like yours, can get them answered too. I'm glad to help, however.
Reply With Quote  
Join Date: May 2006
Posts: 17
Reputation: Maroll is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
Maroll Maroll is offline Offline
Newbie Poster

Re: VB Script Format

  #10  
May 29th, 2006
Ok..nevermind....anyway..thanx 4 da help..it very useful for me
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb Visual Basic 4 / 5 / 6 Marketplace
Thread Tools Display Modes

Other Threads in the Visual Basic 4 / 5 / 6 Forum

All times are GMT -4. The time now is 6:05 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC