All Blog Posts  |  Next Post  |  Previous Post

Scripter Studio - new language features for VBScript / Visual Basic users


Wednesday, May 13, 2009

The latest releases of TMS Scripter Studio and TMS Scripter Studio Pro included several improvements in Basic language syntax. End-users that are used to VBScript and Visual Basic programming will feel much more comfortable with the recent releases. Here is a summary of the improvements:

new statement

To create instances of new classes, you can use new statement with the same parameters as the Create constructor:
MyVar = new TLabel(Self)

const and var declarations

In previous versions you couldn't declare constants in Basic syntax using the "const" keyword. Now you can do that, and even better, you can also initialize variables with default values
  Msg = "Hello World"

Dim A as Integer = 5

Private and Public declaration

You can now define private variables, subs and functions. When a variable or function is declared as private, it is not accessible by other scripts. The default is public. Some examples:
DIM A as Integer    'public
Private B as String  'private
Public C as Char  'public

'public sub
SUB DoSomething
End Sub
'private function
Private Function MyFunction
End Function

Return statement

You can use Return statement to leave a sub of function, and return a value (only in functions, of course):
Function Max(A, B)
  If (A > B) Then
    Return A
    Return B
  End if
End Function

Single line If

There is no need anymore to end an "If" statement with "End If" if the whole statement is in a single line:
If (A > B) then MsgBox("A is higher the B")

Try..Catch..End Try

Just like in Pascal you could use Try..Except..End keywords in Basic to build a exception-catching block. This is still valid, but now you can also use Catch..End Try keywords:
  C = A / B
  MsgBox("Wrong division")
end try

Wagner Landgraf


This blog post has not received any comments yet.

Add a new comment

You will receive a confirmation mail with a link to validate your comment, please use a valid email address.
All fields are required.

All Blog Posts  |  Next Post  |  Previous Post