Share My Creation B4Script - On device basic programming

I am pleased to announce B4Script, an enhanced version of B4A master user AGraham's BasicIDE app. Several things have been modified, moved, added or improved.

The core of both BasicIDE and B4Script is the BasicLibIDE script execution library, by AGraham, which has not changed. Only the IDE and Android extensions have been modified. All credit and gratitude for the library belongs to AGraham.

Changes. To start with the menu structure is completely changed. Gone are the buttons, checkboxes and labels under the editor window. Those have been moved to the Debug menu option. All file operations, including project operations, are in the File Menu option. There is also a Settings menu option. Adding and removing line numbers have also been moved to the Debug menu. This is because the editor edittext view now takes up the entire space of the screen, and automatically resizes when the soft keyboard pops up. This is the way it is supposed to be. It feels right now. Thank you Erel.

One thing to note: Some of the menu options and selection lists use InputList, which I don't like much because the appear cheesy, for the sake of reduced development time, and will be replaced with nicer, more functional prompts and dialogs at some point in the future. The help files for now are the standard BasicIDE help files, and will also be reformatted to appear more pleasing at some point in the future.

The file structure has changed. No longer are files stored in the B4Script folder. There is now the concept of projects. A project is a group of files, some are B4Script files, some are other files like text files and bitmaps, that are stored in their own folder in the B4Script/Projects folder. In IDE mode, FileDirAssets points to this folder. In APK mode, which will be introduced at some point to allow compilation of B4Script projects into an actual APK file that can be uploaded to the Android Market, FileDirAssets points to the actual assets folder. It should also be noted, because I forgot to update the help screens, that FileDirInternal and FileDirDefaultExternal, in IDE mode will point to the projects dir in B4Scripts internal and default external dir's. In APK mode, these dir pathnames will correctly point to the dir as specified by their respective package names, and will not be related to B4Script.

Scripts within a project can run each other with the new Chain and Run commands. In this light, each script is an activity that can be started and stopped at will.

As mentioned in the readme file, standalone scripts, ie. those not associated with a project, are stored in the B4Script/Scripts folder. These are listed in the File/Load menu option when a project is not open. To access one of these when a project is open, first close the project, the use the File/Load menu option.

Creating a new project creates the new folder with the new project name, opens the project, and also creates a new B4Script file by the same name in that folder.

Opening an existing project will limit loading and saving scripts to that project. Close the project to access standalone scripts, or scripts in other projects. Place bitmaps and other files in the project folder with the scripts to access them from the project scripts via the FileDirAssets dir.

My apologies for the lack of time to present this project properly. The help files have been updated. Of importance, is to explore it and have fun.

Change Log:
------------
1.0b: 02/28/12 - Initial beta release
1.00b: 02/28/12 - See post 4 for details
1.01b: skipped somehow >blush<
1.02: 04/10/12 - See post 8 for details
1.03.01: 04/29/12 - See this post for details
1.04: 05/14/12 - see this post for details
1.05: 05-22/12 - see this post for details. See this post for a custom menu system

From this point forward, download the completed app file here.

1.07: 11/13/12 - see this post this post for details.
01/08/13 - uploaded Basic4android project so B4Script projects can be compiled directly to a publishable app. See link above.

To Do List:
-----------
Create a scripts 'gallery' as the startup page for single click running and editing of scripts
Tidy up B4A code
*DONE!* Create APK version of project for simple APK compilation
Create nicer prompts and secondary menus
Create new context sensative help system with updated polished content
Make all B4A view events available
Make all B4A constants available (like Gravity_Top, etc...)
*DONE: #INCLUDE directive to include other scripts at runtime
Autoload settings option to automatically reload last edited script at startup
#AUTOLOAD directive to save cursor position and set it back up when script is loaded
#DEBUG directive to save and load the current scripts debug when script is loaded
Create a list of Sub's for quick and easy code access
Code segregation to isolate one sub at a time in the editor window. Will work with Sub list.
Find and replace in the editor
Try to find a way to read and convert B4A's layout files, so your script's screens can be designed in the B4A designer. I'm thinking if I can read them I can create a B4Script layout file which would be no more than a series of addview, setcolor, settextcolor, etc... statements compiled into a single file, then #INCLUDEd into the project's scripts. Gonna need some help with this Erel :)
Setting option for editor edittext background color

Want something added to the To Do List? Just ask :D
 
Last edited:

qsrtech

Active Member
Licensed User
Longtime User
Forgive me but I seem to be a little confused. Does this library allow you to execute new code within an app such that you wouldn't have to update the app if you wanted to execute something? For example, if I wanted to be able to make my app more "programmable", I could use "pushes" and send a script to be executed, which could hopefully use existing variables, procedures, etc. Is this possible?
 

agraham

Expert
Licensed User
Longtime User
It's a library that can execute Basic language scripts with whatever level of integration with your app that you care to program as you can see from the IDE that is the subject of this thread. The rest of your question is too broad to be readily answerable.
 

qsrtech

Active Member
Licensed User
Longtime User
Sorry if my initial question is kinda vague. Basically if I send a push or even an intent to my app with a "script" to execute such as:
Let's say my app has an activity called "main" with a global variable called "somevariable". Could I run something like "somevariable=1000" and now the app will use the new value assigned to "somevariable"?

How about if I have a sub called "dosomething" in my main activity, can I run this sub with this library? Basically I'd like to try and incorporate as much of my app's code in scripts stored in a DB such that if I need to make a change to something it's a simple matter of updating the script in the db and the app get's the new code without needing to be updated.
 

qsrtech

Active Member
Licensed User
Longtime User
Well I've managed to get my app to "push" a call to a sub within the app, but I'm having trouble figuring out how to get/set global variables within the calling activity. Also, is it not possible to call subs in other modules?
 
Last edited:

agraham

Expert
Licensed User
Longtime User
The limitations on calling Subs from a script are the same as those for using CallSub in the module that initialized the library object, for the same technical reasons.

If you can call a B4A Sub then you should just be able to do anything you want in that Sub and return String values from it.
 
Top