Студенческий сайт КФУ - ex ТНУ » Учебный раздел » Учебные файлы »ПРОГРАММИРОВАНИЕ

Программа Visual Basic Script

Тип: доклад
Категория: ПРОГРАММИРОВАНИЕ
Скачать
Купить
Описание Visual Basic Scripting Edition как скриптового языка программирования, интерпретируемого компонентом Windows Script Host. Правила работы языка и применение VBS-сценариев для обработки данных, управления системой, работы с учетными записями.
Краткое сожержание материала:

Размещено на

Министерство образования и науки Российской Федерации

Гуманитарный институт

Кафедра Иностранных языков №1

Программа Visual Basic Script

Выполнил: студент группы ИС-09

Джек Пётр Владимирович

Проверил:

Сильнягина Мария Владимировна

Тюмень, 2011

1. Introduction

Programming language - formal sign system designed for recording computer programs. The programming language defines a set of lexical, syntactical and semantical rules, that specify the appearance of programs and activities that comply with the Executive (the computer) under its management. One example is the programming language Visual Basic from Microsoft.

Microsoft Visual Basic -- is a software development tool, developed by Microsoft, and includes a programming language and development environment. Visual Basic language has inherited the spirit, style and syntax part of his ancestor - the language BASIC, which has many dialects. At the same time, Visual Basic combines procedures and elements of object-oriented and component-oriented programming languages. VB development environment includes tools for visual designing the user interface.

Visual Basic considered being a good tool for rapid program prototyping, for database application development and, in general, for component ways to create programs that are running operating systems of Microsoft Windows family.

The first recognition by major developers Visual Basic received after the release of the third version - VB3. Final acceptance as a full-fledged programming tool for Windows - with the release of the fifth version - VB5. VB6 version, part of the Microsoft Visual Studio 6.0, has become a truly mature and feature-rich product. After that, the developers of Microsoft have significantly changed the development direction of this technology. As at September 2010 we can speak not only about classic Visual Basic, but also its dialects Visual Basic for Applications (VBA) and Visual Basic Scripting Edition (VBScript).

2. Visual Basic Scripting Edition

Visual Basic Scripting Edition (usually just VBScript) - scripting programming language, is interpreted by Windows Script Host. Is a few truncated version of the usual Visual Basic, appeared in 1991. In the middle of 1998 "seceded" from Visual Basic 6.0. VBScript is used mainly for automating administration of Windows systems, as well as to create ASP pages and scripts for Internet Explorer. VBScript is widely used in the creation of scripts in the operating systems of Microsoft Windows.

Scripting Language - programming language developed to write "scenarios", sequences of operations that a user can perform on the computer. Simple scripting languages earlier is often called batch processing languages. Scripts are typically interpreted rather than compiled (although increasingly adopted compile each time before running).

In the application, the script - is a program that automates some task that without a script the user would do manually, using the program interface.

Windows Script Host (WSH) - component of Microsoft Windows, designed to run scripts in a scripting language JScript and VBScript, as well as in other additional installed languages (e.g., Perl).

VBScript was created by Microsoft as a replacement for outdated batch language, language, is interpreted by application command.com.

COMMAND.COM - shell in the operating systems DOS, Windows 9x family and several others. Loaded at startup (if no other interpreter with SHELL = directive in the file CONFIG.SYS) and executes commands from the file AUTOEXEC.BAT.

3. VBScript scope

Scripts in VBScript language mostly used in the following areas, using the products Microsoft:

· automation of administration of Windows systems;

· server software code in the pages of the ASP;

· client scripts in the browser Internet Explorer.

This type of scenario is typically used for:

· creation of sophisticated scenarios;

· using objects from other applications and libraries;

· hide windows during script execution;

· encryption scriptlogic.

Mainly VBS - scripts are used for data processing, system management, working with user accounts and computers, interaction with business applications, working with data bases and other sophisticated tasks.

VBScript - is an ordinary text file named *.VBS, which is easy to edit in notepad, and launch on the execution - by double click or by calling the name in the console.

Scripts are not compiled but interpreted. That is to process the script in the system must be present interpreter of language VBS, and there are two such interpreters in the Windows: window WScript and console CScript, both this interpreters is Windows Script Host.

4. Language rules

In Visual Basic, are working the following rules:

· string length is not limited;

· no case-sensitive;

· the number of spaces between the parameters is not considered;

· command string can be break, and in brake point is necessary to insert the symbol "_";

· The maximum length of the variable name is 255 symbols;

· Comments are indicated by symbol" ' ".

5. Variables

By default, variables are declared in a script automatically on the first use in the script body, if it is not prohibited by the Option Explicit directive. If in the beginning of the script declare the directive Option Explicit, then all variables must be defined before by the following structures:

Dim ValueName1variable available for all subprograms;

Public ValueName2variable available for all subprograms;

Private ValueName3variable available only for the current program and its subprograms;

Constants are declared at the beginning of the script by using the construction:

Const ConstName1 = Value1constant, accessible for all subprograms;

PublicConst ConstName2 = Value2 constant, accessible for all subprograms;

PrivateConst ConstName3 = Value3constant, accessible only for the current program and its subprograms.

Variable type is assigned automatically after introduction of her first value. In Visual Basic there are the following data types:

· Empty - an uninitialized variable;

· Null - a null variable;

· Boolean - a logical type, the possible values: False, True or 0, 1;

· Byte - a 8-bitunsigned whole number, the possible values: 0 .. 255;

· Integer - a 16-bitwhole number, the possible values: -32768 .. 32767;

· Long - a 32-bitwhole number, the possible values: -2147483648 .. 2147483647;

· Currency - a money type, the possible values: -922337203685477,5808 .. 922337203685477,5807;

· Single - a floating point number, the possible values: -3.402823e38 .. -1.401298e-45 for negative numbers and 1.401298e-45 ..3.402823e38 for positive numbers;

· Double - a floating point number, the possible values: 1.79769313486232e308 .. -4.94065645841247e-324 for negative numbers and4.94065645841247e-324 ..1.79769313486232e308 for positive numbers;

· Date - a date, the possible values: 01.01.1900 и 31.01.9999;

· String - a string variable, capacity up to 2 billion symbols;

· Object - a pointer at the object;

· Error - an error code.

In the VBS-scripts can be used arrays of variables, which allow you to store lists and tables and even more sophisticated designs. One-dimensional arrays (lists) can be dynamic, that is they can change their dimension during the work of scenario. All arrays are declared by command Dim:

Dim ArrayName(Dimension)

6. Objects, their methods and properties

visual basic программирование скриптовый

VBS-scripts, like their parent - the Visual Basic language, are an object-oriented programming language, that is the basic concept is the notion of objects and classes.

Class - is a type that describes the object device. Object means something, which has a certain behavior and way of presenting, the object - is an instance of the class. The class can be compared with the drawing, according to which objects are created. Typically, classes are developing such a way, that their objects match with domain objects.

All objects, works with Windows Script Host, have methods and properties. In order to refer to a method it is necessary to indicate the object, and by the point - the method with the necessary parameters.

A similar situation with the properties, but properties can be assigned and read at variables and other properties, however, should consider the type of data variables and properties, otherwise the script will show an error of incompatibility of data types.

7. Advantages of Visual Basic

· H...

Другие файлы:

A Programmer's Introduction to Visual Basic .NET
A Programmer's Introduction to Visual Basic .NET helps current Visual Basic developers identify and understand some of the major changes are between V...

Visual Basic.Net Black Book
Visual Basic .NET Black Book is a comprehensive reference and problem-solving guide for Visual Basic programmers. It covers Visual Basic.NET tips, ex...

Microsoft Visual Basic 2010 Developer's Handbook
Your expert guide to building modern applications with Visual Basic 2010Take control of Visual Basic 2010—for everything from basic Windows® and web d...

Язык программирования Visual Basic for Applications
Рождение и развитие Basic. Краткое описание Visual Basic for Applications. Новые возможности Visual Basic 5.0. Пример взаимодействия Excel и Visual Ba...

Professional Visual Basic 2012 and .NET 4.5
xplore Visual Basic 2012 and .NET 4.5 with this fully updated resourceAfter a quick review of the of introductory topics of Visual Basic 2012 and .NET...