Learn VBScript Easily : By Rajdip Saha

Share Embed Donate


Short Description

Learn VBScript easily in a step by step format. VBScript is a language by which you can programme small softwares or man...

Description

VBScript: An Easy & Funny  Scripting Language  I am Rajdip Saha & Saha & I am Going To Teach You How To Do VBScripting V BScripting.. Well I Gonna a!e You " VBScript #$pert.

What is VBScript?  It is a scripting language. The main platform in which you can programme it is notepad . From my experience I can tell you that it is quite easy. Its proof is that I am only of 13 years & I learned the whole script…. I think this example was enough for you to understand how easy is !"cripting. "cripting language means a small programming language. !"cript is the language used in ASP  in ASP  #$cti%e  #$cti%e "er%er ages'. It is the primary stage of Microsoft’s Visual Basic. It is (asically a we( script. !ut (eing a we( script it is used for many kinds of things. !"cript is used as a server-side a  server-side scripting scripting language. language. It is not in not in browser  .)ou  .)ou cannot see coding in a (rowser (ecause the scripts are executed on the server  the server . The we( pages you see are the output from $" that is normal HTML. HTML. "o* I am going to teach you the hidden coding of VBScript & I will make sure that you will find it easy. I am sure that you will en+oy e n+oy the tutorial. ,an-t wait to learn /k* so let-s come to the main topic. 0ear earner* if you find it interesting then please* comment & like. )ou can click here here to  to add a like or comment.

Basics of VBScript  /k so let-s get ready to rock…2ere are the (asics )ou will +ust need notepad only to programme !"cript. These are written on notepad and then sa%ed with .%(s extentension. extentension. This means that we should sa%e this as anyname.%(s . To do this +ust write .%(s on the place of .txt & then sa%e it.

0o )ou now $(out aria(les In $lge(ra "omething like* x45* a413 The letter in the a(o%e expression #like x or a' are used to store %alue #like 5'.These letters are called variables* variables* and these can (e used to store %alue. $s with alge(ra* !"cript %aria(les are used to hold %alues or expressions. $ %aria(le can ha%e a short letter like a or a more descripti%e name* like (um(le. !ut this has some different rules like6 i' ii' ii' iii' iii'

They must (egin with a letter They They canno annott ha ha%e more more than han 788 788 cha charac racters ters They They canno annott con conta tain in a per periiod. od. ik ike e #. #.'

In !"cript* all %aria(les are of type variant  that  that can store different types of data. )ou can also declare a %ariant-s #%aria(le' %alue using 94- sign. ike this :xample6 !um(le4 ;sg(ox #e can can also see in the a(o%e example a word written as Msgbo  this  this is used to create a message (ox in which a specific message will appear. There are also other (oxes like6 !nputbo  like6 !nputbo  these  these are used to create a (ox in which we can input any statement. To create create it +ust write Input(ox in the place of ;sg(ox.

*Please Don’t Copy Cop y Paste These Codes To Notepad. If You Want To Try Them Then Please Write It In Notepad. Don’t Copy Paste It. Otherwise The Codes Will Not Run. "a#ple$

Dim Bumble Bumble=Inputbox Bumble=Inputb ox (“Honey”)

To make a %ariant Dim is Dim is used. "a#ple$

Dim Bumble Bumble=Msgbox (“Honey”)

 In this case a dialog box will appear on the screen in which the word ‘Honey’ will be written.

)ou can use %ariants easily.  As$

Dim bumble Bumble=Msgbox Bumble=Msgbo x (“Honey”) Dim rumble

Rumble=Msgbox Rumble=Msgbox (“Hey” & Bumble) It will show ooo2ooooo……… )ou ha%e ha%e already learned half of it. "o you can (e called as a hile...>end >hile...>end statement B 0o not use it B use the 0o...oop statement instead

Easy Explanation of For #ext $o Loop: "a#ple$

.or /r = 0 to > msgbox(/r) next msgbox(-inis') This will pop up a message (ox counting A*1*7*3*@*8 then it will say GFinishG R"M"M#"R in vbscript 0 nearly al$ays counts% "o that code would repeat a command C times "a#ple$

.or /r = 0 to > msgbox('ello) next msgbox(-inis') The message GhelloG would come up C times. /n the Dth time it will say finish. If you add6 step &&& to &&& to t'e end of for var ( ) to *  "a#ple$

.or /r = 0 to > step >

That will make it +ump 8 each e ach time... In this case the message will only show twice (ecause 8 is the limit. )ou can also step down step down as well. "tep B' B' would count down 8 each time. Do, oop The do loop is used to loop a piece of code o%er and o%er and o%er. ;ainly ;ainly used for %iruses !ut you can use them to help you... say if you wanted to keep saying a message until a certain option is picked. )ou ,an always add a ntil on ntil on the do or on the loop part. e.g. Do until var=' !ut in the code you must make it add 1 or more to the %aria(le .. or it will keep on looping. )ou can also use do from thing like6 do $hile var=10& This will only do the commands if  variable  variable (ar) is (ar) is equal to 10H 10H $hhhhhhhh… )ou are almost done… et-s learn the last step6

Extras of %essage Box  /k … let-s talk a(out something harder… The ;sg!ox function creates a dialog (ox with a specified message and prompts the user to click a (utton* upon which the dialog (ox closes and a %alue relating to which (utton was clicked is returned. These %alues* along with their ,onstants* are listed in the ta(le (elow6

Syntax: MsgBox(Prompt, Buttons, Title)

Prompt: The Prompt argument is the message string that appears in the message box. Buttons: The optional Buttons argument must only use the constant or value in the MsgBox !"ST#"TS. Title: The optional Title argument is the title that appears at the top o$ the message box %in&o%. "ote you may use either the Title argument or the 'elpile, ontext arguments. ou cannot use both at the same time. 'elpile: The optional 'elpile argument is a string that speci$ies the help $ile that you %ish to &isplay. This must be either a .chm or .hlp $ile. "ote you may use either the Title argument or the 'elpile, ontext arguments. ou cannot use both at the same time. ontext: The optional ontext argument speci$ies the help context number in the help $ile o$ the topic you %ish to &isplay. *$ you have create& your o%n custom help $ile, then the ontext argument is man&atory.

VBScript Functions Date & Time Codes Code

un!tion

CDate Date Datedd DateDiff DatePart DateSerial DateValue Day FormatDateTime (our +sDate ,inute ,onth ,onth/ame /o! Second Time Timer TimeSerial TimeValue 1ee2day 1ee2day/ame 4ear

Converts a valid date and time expression to the variant of subtype Date Returns the current system date Returns a date to !hich a specified time interval has been added Returns the number of intervals bet!een t!o dates Returns the specified part of a "iven date Returns the date for a specified year# month# and day Returns a date Returns a number that represents the day of the month $bet!een % and %# inclusive' Returns an expression formatted as a date or time Returns a number that represents the hour of the day $bet!een ) and *# inclusive' Returns a Boolean value that indicates if the evaluated expression can be converted to a date Returns a number that represents the minute of the hour $bet!een ) and -.# inclusive' Returns a number that represents the month of the year $bet!een % and %*# inclusive' Returns the name of a specified month Returns the current system date and time Returns a number that represents the second of the minute $bet!een ) and -.# inclusive' Returns the current system time Returns the number of seconds since %*0)) , Returns the time for a specific hour# minute# and second Returns a time Returns a number that represents the day of the !ee2 $bet!een % and 3# inclusive' Returns the !ee2day name of a specified day of the !ee2 Returns a number that represents the year

,ath Codes Codes

un!tions

bs tn Cos 5xp (ex +nt Fix 6o" 7ct Rnd S"n Sin S8r Tan

Returns the absolute value of a specified number Returns the arctan"ent of a specified number Returns the cosine of a specified number $an"le' Returns e  raised  raised to a po!er Returns the hexadecimal value of a specified number Returns the inte"er part of a specified number Returns the inte"er part of a specified number Returns the natural lo"arithm of a specified number Returns the octal value of a specified number Returns a random number less than % but "reater or e8ual to ) Returns an inte"er that indicates the si"n of a specified number Returns the sine of a specified number $an"le' Returns the s8uare root of a specified number Returns the tan"ent of a specified number $an"le'

Format Codes Codes

un!tions

FormatCurrency FormatDateTime Format/umber FormatPercent

Returns an expression formatted as a currency value Returns an expression formatted as a date or time Returns an expression formatted as a number Returns an expression formatted as a percenta"e

Conversion Codes Codes

un!tions

sc CBool CByte CCur CDate CDbl Chr C+nt C6n" CSn" CStr (ex 7ct

Converts the first letter in a strin" to /S+ code Converts an expression to a variant of subtype Boolean Converts an expression to a variant of subtype Byte Converts an expression to a variant of subtype Currency Converts a valid date and time expression to the variant of subtype Date Converts an expression to a variant of subtype Double Converts the specified /S+ code to a character Converts an expression to a variant of subtype +nte"er Converts an expression to a variant of subtype 6on" Converts an expression to a variant of subtype Sin"le Converts an expression to a variant of subtype Strin" Returns the hexadecimal value of a specified number Returns the octal value of a specified number

Strin" Codes Codes

un!tions

+nStr

Returns the position of the first occurrence of one strin" !ithin another9 The search be"ins at the first character of the strin" Returns the position of the first occurrence of one strin" !ithin another9 The search be"ins at the last character of the strin" Converts a specified strin" to lo!ercase Returns a specified number of characters from the left side of a strin" Returns the number of characters in a strin" Removes spaces on the left side of a strin" Removes spaces on the ri"ht side of a strin" Removes spaces on both the left and the ri"ht side of a strin" Returns a specified number of characters from a strin" Replaces a specified part of a strin" !ith another strin" a specified number of times Returns a specified number of characters from the ri"ht side of a strin" Returns a strin" that consists of a specified number of spaces Compares t!o strin"s and returns a value that represents the result of the comparison Returns a strin" that contains a repeatin" character of a specified len"th Reverses a strin" Converts a specified strin" to uppercase

+nStrRev 6Case 6eft 6en 6Trim RTrim Trim ,id Replace Ri"ht Space StrComp Strin" StrReverse :Case

rray Codes Codes

un!tions

rray Filter +srray =oin 6Bound Split :Bound

Returns a variant containin" an array Returns a ;eroorVersion Script5n"ine,inorVersion Type/ame VarType

Creates an ob>ect of a specified type 5valuates an expression and returns the result Returns a Boolean value that indicates !hether a specified variable has been initiali;ed or not Returns a Boolean value that indicates !hether a specified expression contains no valid data $/ull' Returns a Boolean value that indicates !hether a specified expression can be evaluated as a number Returns a Boolean value that indicates !hether the specified expression is an automation ob>ect Returns a number that represents an R?B color value Rounds a number Returns the scriptin" lan"ua"e in use Returns the build version number of the scriptin" en"ine in use Returns the ma>or version number of the scriptin" en"ine in use Returns the minor version number of the scriptin" en"ine in use Returns the subtype of a specified s pecified variable Returns a value that indicates the subtype of a specified variable

>ooo2ooooo… )ou $re Jow $ rogrammer… )ou earned The >hole /ne..

 

If you found my article interesting please like my page or click here.

"our!es# W$"!hool% Instru!ta&les% % Siter  '  ' % School. You Can (earn )"!riptin+ In ,ore Details rom The -&oe "our!es.

 Than/ You You for Readin+ Readin+ ,y -rti!le. est Wishes Wishes for Your Your uture. uture.

 

 You  You Can Read Read ,y Other -rti!les rom rom tecnoraj.we'tart.com -s Well rom authortream.com.. authortream.com  This is !opied from from technoraj.we'tart.com

View more...

Comments

Copyright ©2017 KUPDF Inc.
SUPPORT KUPDF