Revision [16965]

This is an old revision of PuppyBasic made by darkcity on 2011-07-20 11:46:36.


Homepage > Puppy Version

info update The information on this page may be out of date. Any help updating appreciated, more info on the Wiki Index page.


Overview of PuppyBasic

PuppyBasic is the new name for WxBasicscript, which is a simplified version of WxBasic. Mark Ulrich added new functions for the Linux platform.
PuppyBasic offers some "pre-defined" dialogs to make it simple to make simple GUI applications. It is currently version 2.5

Amish is currently working on writing a manual for PuppyBasic


New in [[ PuppyBasic]] V2.5

changes to wxBasic:
New file xwin.c It is included in main.c
The functions from this file were added to builtin.h

Other changes:

Changes are marked with:
changed code

The change in main.c allows to execute wxBasic-commands without passing a filename, like:
puppybasic2 -e 'a=1:b=2:c=a+b:print c'

To compile PuppyBasic, run:

This creates a PuppyBasic-2.5.tar.gz that can be installed as alien Package in Puppylinux, or extracted to all Linuxsystems that meet these dependencies:
sh-3.00# ldd wxbasicscript => (0xffffe000) => /lib/ (0x40014000) => /usr/X11R7/lib/ (0x4003a000) => /usr/X11R7/lib/ (0x40042000) => /usr/X11R7/lib/ (0x4005a000) => /usr/X11R7/lib/ (0x40148000) => /lib/ (0x4015d000)
/lib/ (0x40000000) => /usr/X11R7/lib/ (0x40269000) => /usr/X11R7/lib/ (0x4026d000) => /lib/ (0x40272000) => /usr/X11R7/lib/ (0x40276000) => /usr/X11R7/lib/ (0x402c6000)

PuppyBasic use:

* wxbasicscript included standard in Puppy 1.0.5 and greater
* Write your program using a text editor (even Leafpad / Beaver) into a file with the .wxbs extension;
* Change to executable with ROX

Running Programs

How does one execute a wxbasic program? Do you just type 'wxbasic [filename]'?
When in Puppy any file with the extension .wxbs would be interpreted as a runnable program
You can also run any text file manually as a BASIC progam, with either of these command formats:
# puppybasic helloworld
# wxbasicscript helloworld

For now use rxvt
Create a program in a text editor and save for example

Tutorial for Puppy 1.0.5 wxBasic - Lobster Sep 2005, uses PuppyBasic script created by Mark Ulrich
include "/usr/lib/wxbasicscript/"
result = xmessage ( "-buttons About_Basic,Lesson1,Lesson2,Lesson3,Reference Welcome to the Puppy wxBasic Tutorial Please choose" )
xmessage ( result )
MSG = ""
if result = "About_Basic" then MSG = "you chose about"
if result = "Lesson1" then MSG = "you chose Lesson 1"
if result = "Lesson2" then MSG = "you chose Lesson 2"
if result = "Lesson3" then MSG = "you chose Lesson 3"
if result = "Reference" then MSG = "you chose Reference"
if result = nothing then MSG = "you closed the window"
xmessage ( MSG )

Running the code:
#wxbasicsh helloworld.wxbs (you must have wxbasicscript - details to follow shortly - this page being developed)
wxbasicsh myprogram.wxbsh

You also might add the line
to your program file as the first line to main.wxb, and make it executable:
chmod 755 main.wxb

Then you can start it like a "main.exe":
(or click on it in rox)

Lines beginning with are comments and will be ignored during execution.

Take existing applications, and modify to your needs.

To start, this might be easier:

The main concept:
You have a shellscript, that runs "main.pb" in the /resource -folder.
main.pb basically just displays xxx.tpl, which is the grafical user-interface (GUI).

In the Gui you can see Button-definitions. When a button is clicked, a shell-command or a script is executed, that creates a textfile in /tmp. Then the textarea is refreshed, that's to say it reloads the textfile.

This is right the concept you would need. To determine, if the webserver is running, you might need a shell-command like:
ps|grep httpd >/tmp/httpdcheck.txt

In puppybasic, you execute it like this:
shell( "ps|grep httpd >/tmp/httpdcheck.txt" )

Then you have to open that file, and check if it is empty ot not. If it is not empty, the webserver is running. This method is not 100% exact, but should do it usually. PuppyBasic aka Wxbasicscript
It will be installed together with the example:

There are no comments on this page.
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki