This article is about program and the Program object in Microsoft Small Basic programming language.


What is a Program

According to Dictionary object, a program is a list of instructions in a programming language that tells a computer to perform a task. 

Ways to Run a Program

There are following 3 ways to run a Small Basic program.

  • Click [Run] button in the Small Basic Environment (IDE).
  • Type the compiled program filename in command prompt.
  • See the published program in a browser which supports Silverlight plug-in.

From the Small Basic Environment

A Small Basic program is compiled to an executable file (which has .exe file extension) when [Run] button is clicked.

In the Command Prompt

After compilation, the executable program can be run in the command prompt.

In a Browser

The program uploaded with [Publish] can be run in a browser such as Internet Explorer.

Program Object

Program object in Small Basic has following members (properties and operations):

  • ArgumentCount property - to get the number of command-line arguments passed for the program.
  • Directory property - to get the executing program's directory.
  • Delay operation - to delay the program.
  • End operation - to end the program.
  • GetArgument operation - to get one of the arguments.

For more details, see the reference document here.

Sample Code

' Sample Code for Program Object
 
' ArgumentCount and GetArgument()
For i = 1 To Program.ArgumentCount
  TextWindow.WriteLine(Program.GetArgument(i))
EndFor
 
' Directory
WQ = Text.GetCharacter(34)
TextWindow.WriteLine("Program.Directory=" + WQ + Program.Directory + WQ)
 
' Delay()
TextWindow.WriteLine("Before:" + Clock.Second)
Program.Delay(2000)
TextWindow.WriteLine("After:" + Clock.Second)
TextWindow.Pause()
 
' End()
Program.End()

Sample Program

Following program is using Program object in it.

  • cat - list file (GPD053-0) : Before running this program, comment symbols in lines for File objects should be removed.

See Also

Other Resources