Useful shortcuts for vi editor

Showing posts with label vbs. Show all posts
Showing posts with label vbs. Show all posts

Thursday, 11 December 2014

Basic Calculator VBS example

MsgBox("Calculator!")
a=CInt(InputBox("First number:","Enter number"))
b=CInt(InputBox("Second number:","Enter number"))
c=a+b
msgbox(a & "+" & b & " = "&c)

How to run Visual Basic Script file in Windows?

Please follow the instructions:
  1. Run notepad 
  2. Copy below text into notepad
  3. Save as .vbs format
  4. Double click the file
Example VBS file:

Dim objFS, objFolder
Dim strDir
strDir = CStr(InputBox("Create a directory tool:","Input your new directory"))
Set objFS = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFS.CreateFolder(strDir)
WScript.Echo "I created the folder " & strDir & " using with this powerful tool!"
WScript.Echo "powered by ozsoyler.blogspot.com"
WScript.Quit