Username Password
Bookmark and Share


This macro brings all the power of the 1980's BASIC programming language to your WebGUI site!



  • DATA 1,2,"HI". These will be read sequentially by READ statements. Note that currently all string constants must be quoted.
  • DEF FNA(X)= INT(X + .5).
  • DIM A(20), B(10,10). Arrays default to size 10 (or actually 11 since they start at zero.)
  • END.
  • FOR I = 1 TO 10 STEP 3. STEP defaults to 1 if not given, and may be negative. (For loops are always implemented at least once.)
  • GOTO 30. Note that GOTO 30+(X*3) is also supported.
  • GOSUB 10+X. Gosub is just like GOTO, except that when the programgets to a RETURN statement, it will come back to the statement justafter the GOSUB.
  • IF X > Y THEN 30 ELSE X = X + 1. ELSE is not required. In a THENor ELSE, a lone number means GOTO that number (also known as an impliedGOTO).
  • LET X=4. The word "LET" isn't required; i.e. X=4 is just like LET X=4.
  • NEXT I. Increment I by STEP, test against its limit, go back to theFOR statement if it's not over (or under, for a descending loop) itslimit.
  • ON X-3 GOSUB 10,20. This is equivalent to: IF X-3 = 1 THEN GOSUB 10 IF X-3 = 2 THEN GOSUB 20
  • ON ... GOTO is also allowed.
  • PRINT FOO; BAR$, 6*BLAH. semicolon means no space (or one spaceafter printing numbers!), comma is like a 14-character tab (or \n pastcolumn 56). Print \n after the last expression unless there's asemicolon after it.
  • READ A, B(I), C$. Reads data from DATA statements into variables
  • REM WHATEVER. Anything after the REM is ignored (including colons and succeeding statements!)
  • RETURN. Return to the statement after the last GOSUB.


Example Program

10 FOR J=1 TO 10
20 PRINT "Hello World!<br />"


You're going to need the Language::Basic perl module installed on your server. 

perl -MCPAN -e shell
install Language::Basic

Then copy into your lib/WebGUI/Macro folder, add it to your WebGUI config file, and restart your web server. 



To use this module simply create a Snippet asset with your program in it. Then use the URL of the snippet in combination with the Basic macro to execute your program:




Do not do anything that would cause a loop to not exit. The macro currently has no way to detect infinite loops and therefore the only way to kill a program in an infinite loop is to restart your web server. For this reason I recommend testing your program using a command line interpreter first.  And it just so happens that I've included a command line interpreter as an attachment to this post. To use it just type:

perl programname.bas



1.0.0 - Initial release

1.0.1 - Bugfix in output redirect thanks to Martin Kamerbeek 


System RequirementsPlease be advised: this contribution was tested with something older than WebGUI 7.5. When this contribution was uploaded there was no field for the author to fill out regarding it's requirements.
3ehab: "
Is this still valid for newer versions of WebGUI.

This could be a real killer if there was a way to pass data from and to WebGUI this could be a full scripting language for WebGUI to fill in all the simple where writing a macro is just too much. 

Ehab Heikal ,

Quote: An eye for an Eye only helps make the whole world blind

Downloadbasic_pl.txt basic_pl.txt
LinksNo Support Offered
Statistics Downloads: 1753
Views: 3935
Rating: 3
Updated: 9/14/2007
Keywords acme
NavigationBack to the Bazaar
© 2022 Plain Black Corporation | All Rights Reserved