Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Mon 25 May 2015, 07:52
All times are UTC - 4
 Forum index » House Training » HOWTO ( Solutions )
How to use BASIC in Puppy
Moderators: Flash, Ian, JohnMurga
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 1 of 1 Posts_count  
Author Message

Joined: 20 Oct 2005
Posts: 451
Location: Boston MA USA

PostPosted: Fri 02 Dec 2005, 12:08    Post_subject:  How to use BASIC in Puppy  

HOWTO use BASIC in Puppy

Yes, there is BASIC hidden in Puppy (versions 1.0.5 and 1.0.6)!

PuppyBasic is wxbasicscript, a simplified version of wxBasic.


From the desktop, click on the <console> icon, to get a command line.

This command tells PuppyBasic to take the program directly from the keyboard:
# puppybasic /dev/tty

Now you can enter your program:
print "Hello World"

On the next line, just enter CTRL-D to finish entering the program. Then the program will run immediately!


That is actually a good way to try some simple commands, to see quickly how they work. But you will soon want to use an editor for your programs.

Change to a temporary directory:
# cd tmp

Make a program file:
# leafpad hellow

In the editor, enter the file and save and exit:
' My first program
print "Hello World"
print 2+2
print "Goodbye"

Now you can run the program:
# puppybasic hellow

Program development tip:
For quickly making changes and testing them, use the up-arrow key on the command line, to access your previous commands to use the editor or run the program.
For some reason, it does not seem to work to leave the editor open while you try out program changes. But if you open the editor in another one of your four "workspaces", then you can leave it open -- just Save and switch to the console in the other workspace to try it out.

If you have not used BASIC since the 1980's, the line numbers and REM statements seem to be gone, so you will have to brush up on this version.

Use the desktop FIND command to search for files containing wxbs in their names, to see complex examples in Puppy.

You can learn more at:

(There is supposed to be an automatic system of executing BASIC programs in Puppy, based on naming files with .wxbs extensions, but it does not seem to work for simple command line text programs.)
Back to top
View user's profile Send_private_message 
Official Crustacean

Joined: 04 May 2005
Posts: 15121
Location: Paradox Realm

PostPosted: Fri 02 Dec 2005, 13:35    Post_subject: first script program  

Good stuff - well done Smile

A piece of code like this
(note you are telling it to run xbasic and call a 'library'
- basefunctions.inc)

include "/usr/lib/wxbasicscript/basefunctions.inc"
//My First Runnable Script

xmessage ( "I am a Xmessage" )

  print "Hello World"
  print 2+2
  print "Goodbye and thanks for all the fish"


when given changed permissions with rox
(make it excutible)
will run the message BUT the other parts require a command line interface
so run console (right click and open xterm where your script file is)
then type ./myscript (where myscript is the name of your executible text script)

Now you should get a prog in a window and the results of 2+2 etc in the rxvt console window . . .

Hope that works for you Smile

Puppy WIKI

Back to top
View user's profile Send_private_message Visit_website 

Joined: 20 Oct 2005
Posts: 451
Location: Boston MA USA

PostPosted: Fri 02 Dec 2005, 18:59    Post_subject: This is not so easy!  

Hmmm... This is not so easy!
I have gotten your example to work. Sort of...
It seems like PuppyLinux does not associate file types with execute modules? The file extensions are mostly arbitrary/meaningless, just to help the humans keep track of things?
It seems like making a file "executable" just means the system is willing to process it as a shell script, if it is text? (How does it distinguish from real binary code?) But for some reason, the current directory is not in the default path, so you need to use ./ to force a reference to the current directory...
The leading #! on the first line tells it where to go for the real executable, to process the text code lines that follow?
The include line just includes text from another file as though it appeared at that point?
The xmessage code makes a window, and requires the included library code to be defined. (After the window closes, sometimes getting "focus" back in the text window is a problem.)

This seems like it may be a reasonably simple way to do complicated (GUI) things -- but so far it seems like a pretty complicated way to do simple things. In terms of simple command line text mode BASIC programs, it seems like there is no advantage to the wxbs naming convention or the #! invocation. (In fact, in the tests I just did, the #! seemed to over-ride my manual invocation of puppybasic from the command line, and prevent me from being able to pass flags like -trace.)
Back to top
View user's profile Send_private_message 

Joined: 20 Oct 2005
Posts: 451
Location: Boston MA USA

PostPosted: Sat 10 Dec 2005, 18:55    Post_subject:  

3 sample PuppyBasic programs:
Back to top
View user's profile Send_private_message 
Display_posts:   Sort by:   
Page 1 of 1 Posts_count  
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » House Training » HOWTO ( Solutions )
Jump to:  

You cannot attach files in this forum
You can download files in this forum

Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0537s ][ Queries: 12 (0.0037s) ][ GZIP on ]