Vbscript kurs pdf




















Jay H. Your book is very well written. I am very new to WSH and I think your book is a great start for me. Surush C. It brings a lot of very important developer concepts together clearly. Michael G. I have worked with WSH, but it seemed as though I was always hitting some sort of syntax or run-time errors that prevented me from using the scripting language as fluently I am the Director of Information Technology for a company that, because of legacy proprietary programs and devices, has a network that must incorporate DOS 5.

While batch files ore OK for the older OSs, they are clunky at best in Win9x, and Win doesn't really like them at all. I have known about WSH for some time, but I never had the time to "figure out" all of the little roadblocks I was encountering in its implementation.

When I first saw the cover price of your book, I thought to myself "yeow! I bought the book it's actually worth twice the price , recommend it to anyone who knows what scripting is, and I can hardly wait for the next advanced edition.

As you state, scripting is a very powerful, hot technology, and until now, it has been under-documented and perhaps even under-rated. Again, thank you for your fine book. Steve S. I can recommend your book very highly even though I have not finished reading it yet. Gary Mc. The first one has whetted my appetite, and I am looking forward to seeing the second.

Don R. Es wirklich fantastisch. Ich habe viele Anregungen bekommen -- und noch mehr gute Ideen. Friedemann S. Helma S. Each value is called a Case, and the variable being switched ON based on each case. Case Else statement is executed if test expression doesn't match any of the Case specified by the user. Case Else is an optional statement within Select Case, however, it is a good programming practice to always have a Case Else statement.

Case expressionlistn statement1 statement Case Else elsestatement1 elsestatement Hence, Case 1 would be executed. In general, statements are executed sequentially: The first statement in a function is executed first, followed by the second, and so on. Programming languages provide various control structures that allow more complicated execution paths.

A loop statement allows us to execute a statement or group of statements multiple times and following is the general from of a loop statement in VBScript. VBScript provides the following types of loops to handle looping requirements. Click the following links to check their detail. Loop Type Description for loop Executes a sequence of statements multiple times and abbreviates the code that manages the loop variable. While statements will be executed as long as condition is True.

Until statements will be executed as long as condition is False. For Loops A for loop is a repetition control structure that allows a developer to efficiently write a loop that needs to execute a specific number of times.

This step allows you to initialize any loop control variables and increment the step counter variable. If it is true, the body of the loop is executed. If it is false, the body of the loop does not execute and flow of control jumps to the next statement just after the For Loop.

This statement allows you to update any loop control variables. It is updated based on the step counter value. If it is true, the loop executes and the process repeats itself body of loop, then increment step, and then again condition. After the condition becomes false, the For Loop terminates. Each Loops A For Each loop is used when we want to execute a statement or a group of statements for each element in an array or collection.

A For Each loop is similar to For Loop; however, the loop is executed for each element in an array or group. Hence, the step counter won't exist in this type of loop and it is mostly used with arrays or used in context of File system objects in order to operate recursively. Wend Loop In a While.. Wend loop, if the condition is True, all statements are executed untilWend keyword is encountered. If the condition is false, the loop is exited and the control jumps to very next statement after Wend keyword.

Syntax The syntax of a While.. Wend loop in VBScript is: While condition s [statements 1] [statements 2] While statement A Do.. While loop is used when we want to repeat a set of statements as long as the condition is true. The Condition may be checked at the beginning of the loop or at the end of the loop. Syntax The syntax of a Do.. The statements inside the loop are executed only if the condition becomes True.

The Major difference between these two syntax is explained below with an example. Do [statement 1] [statement 2] The Statements inside the loop are executed at least once even if the condition is False. Hence loop is executed once. The value of i is : 11 Do.. Until Loops A Do.. Until loop is used when we want to repeat a set of statements as long as the condition is false. The Condition may be checked at the beginning of the loop or at the end of loop. Until loop to check the condition at the beginning of the loop.

The Statements inside the loop are executed only if the condition is false. It exits out of the loop when the condition becomes true. The value of i is : 11 The value of i is : 12 The value of i is : 13 The value of i is : 14 The value of i is : 15 The value of i is : 16 Alternate Syntax There is an alternate Syntax for Do..

Until loop which checks the condition at the end of the loop. Until loop to check the condition at the end of the loop. The Statements inside the loop are executed at least once even if the condition is True. The value of i is : 11 Loop Control Statements Loop control statements change execution from its normal sequence.

When execution leaves a scope, all the remaining statements in the loop are NOT executed. VBScript supports the following control statements. Control Statement Description Exit For statement Terminates the For loop statement and transfers execution to the statement immediately following the loop Exit Do statement Terminates the Do While statement and transfers execution to the statement immediately following the loop Exit For statement A Exit For Statement is used when we want to Exit the For Loop based on certain criteria.

When Exit For is executed, the control jumps to next statement immediately after the For Loop. If the value of the Counter reaches 4, the For Loop is Exited and control jumps to the next statement immediately after the For Loop. It can be used within both Do.. While and Do..

Until Loops. When Exit Do is executed, the control jumps to next statement immediately after the Do Loop. If the value of the Counter reaches 10, the Do Loop is Exited and control jumps to the next statement immediately after the For Loop. When the page loads, that is an event.

When the user clicks a button, that click too is an event. Other examples of events include pressing any key, closing window, resizing window, etc. Developers can use these events to execute VBScript coded responses, which cause buttons to close windows, messages to be displayed to users, data to be validated, and virtually any other type of response imaginable to occur. Here, we will see few examples to understand a relation between Event and VBScript.

You can put your validation, warning, etc. This event occurs when you try to submit a form. So you can put your form validation against this event type. The Form is submitted by clicking on Submit button, the message box appears. The onmouseover event occurs when you bring your mouse over any element and the onmouseout occurs when you take your mouse out from that element.

Here, script indicates a VBScript function to be executed against that event. But for a commercial website, it is required to maintain session information among different pages.

For example, one user registration ends after completing many pages. But how to maintain user's session information across all the web pages. In many situations, using cookies is the most efficient method of remembering and tracking preferences, purchases, commissions and other information required for better visitor experience or site statistics. How It Works? Your server sends some data to the visitor's browser in the form of a cookie. The browser may accept the cookie.

If it does, it is stored as a plain text record on the visitor's hard drive. Now, when the visitor arrives at another page on your site, the browser sends the same cookie to the server for retrieval. If this is blank, the cookie will expire when the visitor quits the browser. This may be blank if you want to retrieve the cookie from any directory or page. If this field is blank, no such restriction exists.

Cookies were originally designed for CGI programming and cookies' data is automatically transmitted between the web browser and web server, so CGI scripts on the server can read and write cookie values that are stored on the client. VBScript can also manipulate cookies using the cookie property of the Document object.

VBScript can read, create, modify and delete the cookie or cookies that apply to the current web page. Storing Cookies The simplest way to create a cookie is to assign a string value to the document. If you provide this attribute with a valid date or time, then cookie will expire at the given date or time and after that cookies' value will not be accessible. Example Following is the example to set a customer name in input cookie. Now enter something in the textbox and press the button "Set Cookie" to set the cookies.

You will learn how to read this cookie in next section. Reading Cookies Reading a cookie is just as simple as writing one, because the value of the document. So, you can use this string whenever you want to access the cookie. The document. We will discuss Arrays in a separate chapter; until that time, please try to digest it. It will produce the following result. Now, press the button "Get Cookie" to see the cookies, which you have set in previous section.

Note: There may be some other cookies already set on your system. So, tnhe above code will show you all the cookies set on your system. Setting the Cookies Expiration Date You can extend the life of a cookie beyond the current browser session by setting an expiration date and saving the expiration date within the cookie. This can be done by setting the expires attribute to a date and time. To do this, you just need to set the expiration date to a time in the past.

It also helps them to make use of the inbuilt mathematical functions associated with VBScript. Number Conversion Functions Number functions help us to convert a given number from one data subtype to another data subtype. It takes one of the three values based on the below settings parameter.

Function Description Int A Function, which returns the integer part of the given number Fix A Function, which returns the integer part of the given number Log A Function, which returns the natural logarithm of the given number.

Negative numbers disallowed Oct A Function, which returns the Octal value of the given percentage Hex A Function, which returns the Hexadecimal value of the given number Rnd A Function, which returns a random number between 0 and 1 Sgn A Function, which returns a number corresponding to the sign of the specified number Sqr A Function, which returns the square root of the given number.

A variable is said to be a string if it is enclosed within double quotes " ". Below are String methods that are supported in VBScript. Please click on each one of the methods to know in detail. Search happens from left to right.

InstrRev Returns the first occurrence of the specified substring. Search happens from Right to Left. Lcase Returns the lower case of the specified string. Ucase Returns the Upper case of the specified string. Left Returns a specific number of characters from the left side of the string. Right Returns a specific number of characters from the Right side of the string.

Ltrim Returns a string after removing the spaces on the left side of the specified string. Rtrim Returns a string after removing the spaces on the right side of the specified string.

Trim Returns a string value after removing both leading and trailing blank spaces. Len Returns the length of the given string. Replace Returns a string after replacing a string with another string. Space Fills a string with the specified number of spaces. StrComp Returns an integer value after comparing the two specified strings. String Returns a String with a specified character the specified number of times. StrReverse Returns a String after reversing the sequence of the characters of the given string.

The search happens from left to right. Specifies the starting position for the search. The search begins at the first position from left to right. String to be searched. String against which String1 is searched. Specifies the String Comparison to be used. The Search happens from right to Left. Specifies the Starting position for the search. The Search begins at the first position from right to left.

Input String from which the specified number of characters to be returned from left side. An Integer, which specifies the number of characters to be returned. Input String from which the specified number of characters to be returned from Right side. An Integer, which Specifies the number of characters to be returned. Input String from which the specified number of characters to be returned. An Integer, which Specifies starting position of the string.

The Input String from to be searched for replacing. The Part of the String that will be be replaced. The replacement string, which would be replaced against the find parameter. Specifies the start position from where the string has to be searched and replaced. Default value is 1. Specifies the number of times the replacement has to be performed. Specifies the comparison method to be used. Default value is 0.

Syntax space number number, a Required Parameter. The number of spaces that we want to add to the given string. It can return any of the three values -1, 0 or 1 based on the input strings to be compared. The first String expression. The second String expression. An integer value, which would be repeated for the specified number of times against the character parameter. Character value, which has to be repeated for the specified number of times.

We know very well that a variable is a container to store a value. Sometimes, developers are in a position to hold more than one value in a single variable at a time. When a series of values is stored in a single variable, then it is known as an array variable.

Array Declaration Arrays are declared the same way a variable has been declared except that the declaration of an array variable uses parenthesis. In the following example, the size of the array is mentioned in the brackets. Hence, an array can store an integer, string or characters in a single array variable. Assigning Values to an Array The values are assigned to the array by specifying array index value against each one of the values to be assigned.

Tin;r, lvas rnachst rlu heute Abencl? Sag, h. Q Tina! Wie gern ich dich mag! He ute ist der Tag! Was ,,sehen" Sie? Ein Kind singt. E I Der Mann telefoniert mit seiner Tochter. Sie dann noch einmal. Notieren Sie auch die lnfinitive. Wann rufst du mich an? FluSzeuE r Bahnsteig r Koffer! Holst du mich am Bahnhof ab? Wann kommst du an? Ja, bis bald. Mach's gut! Gut, dann bis morgen. Pass auf dich auf! Also dann, auf Wiedersehen. Wie verabschiedet man sich in lhrer Muttersprache? Bitte Vorsicht!

Auf Gleis W-Frage Wann rufst du mich an? Zug aus ,.. Rufst du mich an? Wo steigen wir aus? Ja-lNein- Frage heute Wo steigst du ein? AUI Ulels Wann ab? Bis morgen. Fahren Sie auch gern Fahrrad? Wie oft und wohin? I Also, ich fahre sehr gern Fahrrad. Ich fahre nie Fahrrad. Ich habe gar kein Fahrrad. Ich glaube, Anja ist 29 Jahre Kindor'. Hallo Anja, was machst du rE- gerade? D gerade.

Um Viertel vor neun gehe ich ins Ich rufe heute noch Frau Dr. Weber an Sehen Sie das Bildlexikon zwei Minuten lang an. Machen Sie das heute? Dann stehen Sie auf. I Anja ist schwanger. Sie hat bekommt ein Baby. Anja hat am Vormittag am Nachmittag gearbeitet. Gibt's was Neues? Was hast heute Morgen telefoniert' Dr.

Weber habe ich sie gesagt' Du denn heute alles gemacht? Weber angerufen? Was hat sie gesagt? Du hattest auch lstdasnichtsuPerrl 9 9g, orchesterprobe heute, richtig? Was habe ich noch gemacht? Ach ja: lch habe Dir und nicht in dieser Stadt hier. Machen Sie eine Bewegung. F a Machen Sie Notizen. Ith habo um giebon Uhr S. Ab 9 Uhr Verben auf telefonieren erlsie hat telefoniert ouch so: fotografieren - fotografiert, W-Frage Was hast du sonst noch gemacht?

Was ist hier passiert? Geburtstag gefeiert. Wir haben viel getanzt und gelacht. Dezember an den letzten sechs Tagen. Eifel dauert zwei bis drei Tage. Es kommen Jahreszahlen Hilfe finden Sie im Bildlexikon.

E ist in I dauert Ich tanze gern. Das klingt interessant. Ich liebe Rockmusik. Das Festival hat ihnen gut gefallen. Im September fahren sie nach Berlin. Mi nrhon Schreiben Sie Stichpunkte auf einen Zettel. Jeder Teilnehmer liest einen Zettel vor. Die anderen raten: Meine Person war auf dem Oktoberfest in Wer hat das geschrieben? Das war letztes Jahr im Herbst Hast du schon einmal?

Es war nicht viel Verkehr. Danach bin ich gleich losgegangen. Sehr, sehr lecker! Hast du das,,Technik Museum Speyer" gesehen? Ich finde Mannheim super. So, jetzt kaufe ich noch ein biss- in New York chen ein und heute Abend gehe ich in ein Konzert oder zum Tanzen in einen Club. Mal sehen. Die Sommer in Musik war toll und die Leute waren sehr nett. Der Tipp war super! So viel Rosa habe ich noch nie gesehen. Aber leider ist das Wochenende schon fast vorbei. Drei Monate auf lava und Borneo Wie schade!

Lesen Sie dieTexte und markieren Sie den passenden Link. E Was hat Anja wann gemacht? Ca,oissants backcn, Zc. Jahren Wie war es? Lesen Sie die Tou risten information und kreuzen Sie an. Suchen Sie lnformationen im Internet und planen Sie lhren Tag. Wie kommen Sie dorthin? Planen Sie dann:. Wie lange dauern die Fahrten? Minuten gedauert. E lhre Musik Zu welcher Musik tanzen Sie gern? Bilden Sie Gruppen. Wo tanzen Sie? Wann und wie oft tanzen Sie? I Woher kommen Sie, Frau Kowska? A Sie sind auf einer Konferenz.

B Sie sind auf einer Party. Hallo, Nathalie! Wie geht's? Sehr gut, und dir? Danke, gut. Und lhnen? T Es geht. Welche Zahl fehlt?

Was arbeiten Sie? Fragen Sie jetzt die anderen paare im Kurs. Hat jemand etwas mit Ihnen gemeinsam? Wo wohnt ihr? Wir wohnen in Was arbeitet ihr? Wir arbeiten als Ja, und wir sind Kellner von Beruf, okay? KB Was machst Ausbildung und Beruf du beruflich? Woher kommt sie? Jetzt ist Person B an der Reihe. Gewonnen hat die Person mit den meisten Karten. Familienstand: Alter: Machen Sie zwei falsche Angaben.

Nein, mein Bruder ist nicht verheiratet. Mein Bruder ist nicht verheiratet. Verstehen Sie ein Wort nicht? Sonja Wilkens ist Krankenschwester und 32 Jahre alt. Sie ist nicht verheiratet und hat ein Kind. Sie wohnt in Leipzig. Bo Martinson kommt aus Schweden und wohnt in Essen. Er ist 50, hat zwei Kinder und ist verheiratet. Er arbeitet als Ingenieur. Peter und Franziska sind 28 und 25 Jahre alt.

Sie sind nicht verheiratet, aber sie leben zusammen in Wolfsburg. Sie arbeiten bei VW und haben keine Kinder. Was kostet bei lhnen derTisch, der Stuhl? Notieren Sie die Preise. Fragen Sie und notieren Sie die Preise. Setzen Sie das Puzzle zusammen.

Ja, er kostet 79,90 Euro. Das Bett ist modern und der Schrank ist praktisch. I Ich schwimme fast nie. B Er ist 51 Jahre alt. Helga Stiemer ist 67 und Rentnerin.

Sie ist verheiratet und hat drei Kinder. Carlos kommt aus Spanien und wohnt in Kiel. Er ist nicht verheiratet und hat keine Kinder. Astrid und Norbert sind nicht verheiratet, sie sind geschieden.

Astrid lebt in Hannover und Norbert und die Kinder leben in Hamburg. Astrid ist 32 und Norbert ist 37 Jahre alt. KB t5. Sehen Sie im Bildlexikon nach. Wer bietet am meisten? Hier: eine super I Hier: eine super Kette! Sie ist aus Plastik und sehr leicht! Sie ist rot und sehr modern. Der Startpreis ist nur 1 Euro! Hier: einleine super! I ErlEslSie ist aus Der Startpreis ist nur I Wie bitte? I Wie schreibt man Ring? Schreiben Sie zu zweit einen Chat. Keine Gehen lWann Um Okay. Achten Sie auf die richtige Satzstellung.

I Wann kommst du an? Suchen Sie die passende Antwort. Was hat er letzte Woche gemacht? Was wollen Sie machen und wann treffen Sie sich? Hast du am Montag Zeit? Am Abend um 19 Uhr? Ja, bis dann. Wer ist der Gast? Was kochen Sie? Was schenkt der Gast? Spielen Sie kleine Szenen.



0コメント

  • 1000 / 1000