ScriptBasic

Open Forum => What's New => Topic started by: Support on April 07, 2012, 10:13:39 pm

Title: ScriptBasic for Android
Post by: Support on April 07, 2012, 10:13:39 pm
Armando Rivera and our new ScriptBasic developer Steve Dover were able to get scriba (ScriptBasic command line interpreter) working on Google Android Linux.

(http://files.allbasic.info/ScriptBasic/sb_android.png)

If you would like to run scriba on a unrooted device, you need to install it in the /data/data/jackpal.androidterm directory (or the directory your terminal app uses) to make it executable and read/write files.

Quote
It would be nice if you could put native binaries directly onto the SD card (either external or built-in) but you can't. Well, you can — but you won't be able to set execute permissions on them, which means they won't run. The SD card is mounted in such a way as to prohibit setting 'x' permissions. You can set execute permissions in the app storage area — that part of the filesystem that is rooted at /data/data. On an unrooted device you won't be able to create files just anywhere in this directory, because each app has its own security credentials — effectively each app runs as a different user. Only one directory under /data/data will be writeable by a specific app. Once you've found that directory, you can copy a binary into it, and run it at the terminal emulator prompt.

Quote
The results show that native C applications can be up to 30 times as fast as an identical algorithm running in Dalvik VM. Java applications can become a speed-up of up to 10 times if utilizing JNI.
Title: Re: ScriptBasic for Android
Post by: Support on April 08, 2012, 03:01:12 am
Quote from: AIR
If you're using the Android Terminal app,  I think you should be able to create a directory via adb called /data/local/bin on a non-rooted device.  Then use adb to copy scriba there, and when you launch the Terminal app, scriba will be in the path that the app sets up.

I've managed to embed scriba within the Term.apk file itself, but it needs to be extracted from the apk so that the shell can find it, which I haven't worked out yet (building Win7 systems for a client this weekend.  Yuck.  sysprep to the rescue.)

A.

Updated Instructions

Code: [Select]
adb shell
mkdir /data/local/bin
exit
adb push scriba /data/local/bin/
adb push hello4.bas /sdcard

adb shell
cd /data/local/bin
ls -l (check permissions)

if needed, chmod 755 scriba

Then in Term app: scriba /sdcard/hello4.bas
Title: Re: ScriptBasic for Android
Post by: Support on May 03, 2012, 08:33:31 pm
The phone I have been waiting for.

(http://www3.pcmag.com/media/images/288840-samsung-galaxy-s-iii.jpg)     (http://timenerdworld.files.wordpress.com/2012/05/galaxysiii.jpg?w=600&h=400&crop=1)

Samsung Galaxy S III (http://www.samsung.com/global/galaxys3/index.html)

quad core 1.4 GHz Exynos CPU

Detailed Review (http://www.techradar.com/reviews/phones/mobile-phones/samsung-galaxy-s3-1078667/review#articleContent)
Title: Re: ScriptBasic for Android
Post by: Support on May 07, 2012, 04:01:14 am
I was able to get ScriptBasic for Android to display an Android GUI message box (makeToast) from a SB script. This is using the SL4A (Scripting Layer for Android)

Code: [Select]
OPEN "localhost:56098" FOR SOCKET AS #1
PRINT #1,"{id:1,method:makeToast,params:[\"ScriptBasic\"]}"

Title: Re: ScriptBasic for Android
Post by: Support on May 08, 2012, 07:29:06 am
I was using SL4A r4 to run my initial tests. I found that I had to look at the properties of the RPC server to get the port it assigned. This was a PITA but this is proof of concept so I didn't mind the extra step. I recently installed SL4A r5 and it allows setting a default port for the RPC server.

What's new in SL4A - Scripting Layer for Android r5:

Android API (http://code.google.com/p/android-scripting/wiki/ApiReference)
Title: Re: ScriptBasic for Android
Post by: Support on May 13, 2012, 05:46:26 am
Here is an example of a request / response call to the SL4A RPC server. This is opening a SB socket and sending a JSON packet to the RPC scripting server. (see attached screenshot)

The Androids API (scripting version) is fairly extensive. I would be willing to help build this interface if others contribute. I'll post a few high level functions to get the ball rolling and see what happens. My initial goal was to create a proof of concept and see if others saw promise or not. If there is no interest by others then I'll return to my IUP project and revisit this again at later time.
Title: Re: ScriptBasic for Android
Post by: Support on May 13, 2012, 05:25:12 pm
I'm playing around with a JSON response parser that creates a SB associative array. This is my first stab at it and may find a better way.

Code: [Select]
r = """{"error":null,"id":1,"result":"gsm"}"""
r = MID(r,2)
r = LEFT(r,LEN(r) - 1)
r = REPLACE(r, "\"", "")
SPLITA r BY "," TO t
FOR x = 0 to UBOUND(t)
  a{LEFT(t[x],INSTR(t[x],":")-1)} = MID(t[x],INSTR(t[x],":")+1)
NEXT

PRINT a{"error"},"\n"
PRINT a{"id"},"\n"
PRINT a{"result"},"\n"

jrs@laptop:~/sb/test$ scriba json_in.sb
null
1
gsm
jrs@laptop:~/sb/test$
Title: Re: ScriptBasic for Android
Post by: Support on May 13, 2012, 07:11:22 pm
The following Facade's are available for ownership. Please let us know which Facade you will be working on. I will be doing random functions to help with areas that aren't well documented.

Android SL4A API (http://code.google.com/p/android-scripting/wiki/ApiReference)


Title: Re: ScriptBasic for Android
Post by: Support on May 13, 2012, 09:34:51 pm
I started building an Android SL4A module to kick things off. Don't wait too long or your favorite Facade may be taken.  ;)

Code: [Select]
' Android SL4A Interface
'
' ScriptBasic Open Source Project
'
' Contributors:
'   John Spikowski (JRS)
'
' Change Log:
'   20120513 - Initial module created

MODULE DVM

OPEN "localhost:9999" FOR SOCKET AS #1

id = 1

FUNCTION JSON2SB(json_response)
  LOCAL r,t,x,a
  r = MID(json_response,2)
  r = LEFT(r,LEN(r) - 1)
  r = REPLACE(r, "\"", "")
  SPLITA r BY "," TO t
  FOR x = 0 to UBOUND(t)
    a{LEFT(t[x],INSTR(t[x],":")-1)} = MID(t[x],INSTR(t[x],":")+1)
  NEXT
  JSON2SB = a
END FUNCTION


'**************
' PhoneFacade *
'**************

FUNCTION getPhoneType()
  LOCAL r, a
  PRINT #1,"""{"id":""" & id & ""","method":"getPhoneType","params":[]}\n"""
  LINE INPUT #1, r
  a = JSON2SB(r)
  IF a{"error") <> "null" THEN
    getPhoneType = undef
  ELSE
    getPhoneType = a{"result"}
  END IF
  id += 1
END FUNCTION


END MODULE

Untested at time of posting.
Title: Re: ScriptBasic for Android
Post by: kryton9 on May 13, 2012, 11:14:30 pm
I have lots of catching up to do John, you are moving right along. That is great.
Title: Re: ScriptBasic for Android
Post by: Support on May 14, 2012, 04:08:39 am
While testing the new DVM module, I discoved that calling a SUB or FUNCTION puts it in an endless loop. The same test programs work fine on Ubuntu scriba. I have a funny feeling the initial ARM gcc bug that Steve found has raised it's ugly head again.  >:(
Title: How did you install SB and Terminal in AVD
Post by: kryton9 on May 14, 2012, 06:47:10 am
John, I finally got Android SDK installed with eclipse and setup an AVD device, but I can't figure out how you got Scriptbasic and the Terminal App as well as sl4a on it, the Virtual Android Device, not a real one?

updated:
I tried ADB and got scriba over there, but how did you download terminal and get that over to it?  Thanks in advance.
Title: Re: ScriptBasic for Android
Post by: Support on May 14, 2012, 07:10:09 am
You can get the jackpal terminal from github (https://github.com/jackpal/Android-Terminal-Emulator/downloads)

SL4A can be downloaded from HERE (http://code.google.com/p/android-scripting/).

I don't see the FUNCTION/SUB looping issue taking too long to fix.

If your using the Linux Android emulator, I use adb to push everything to the SDCARD. (emulated with a file)

Title: Re: ScriptBasic for Android
Post by: Support on May 14, 2012, 07:26:57 am
Good News!

I found a workaround until the SB dev team solves the SUB/FUNCTION issue. SL4A allows you to access the RPC server on the phone/pad/emulator if you start the server as a public connection. This assigns an accessible IP address rather then localhost. I can use scriba that is running on my Ubuntu 64 box and control the Android device via RPC. I should be able to move the scripts (untouched) to the Android device once Armando generates a new scriba.

Title: Re: ScriptBasic for Android
Post by: kryton9 on May 14, 2012, 04:41:17 pm
Thanks John for the links. I decided to use the emulator, first to learn it and also to try to match what you are doing and then when it works on the emulator then try it on the tablet. Since my cell phone is my only phone and I need to rely on it, I don't want to experiment too much with it.
Title: Re: ScriptBasic for Android
Post by: kryton9 on May 14, 2012, 09:20:09 pm
John, I got it working now, thanks.  I also got the
Quote
OPEN "localhost:56098" FOR SOCKET AS #1
PRINT #1,"{id:1,method:makeToast,params:[\"ScriptBasic\"]}"
working with the port assigned from my emulator.
Title: Re: ScriptBasic for Android
Post by: kryton9 on May 14, 2012, 09:35:23 pm
John, I am just trying to wrap my mind around the overview of how things are working.
scriba is native code that bring scriptbasic to android, but it doesn't interface to the android api and that is what you are trying to do with Facades?

Here is a point of confusion for me: http://code.google.com/p/android-scripting/wiki/InterpreterDeveloperGuide
Lists 3 ways of bringing a language in, I don't see where Facades fit in?

Thanks in advance for any clarification.



The following Facade's are available for ownership. Please let us know which Facade you will be working on. I will be doing random functions to help with areas that aren't well documented.

Android SL4A API (http://code.google.com/p/android-scripting/wiki/ApiReference)

  • ActivityResultFacade
  • AndroidFacade
  • ApplicationManagerFacade
  • BatteryManagerFacade
  • BluetoothFacade
  • CameraFacade
  • CommonIntentsFacade
  • ContactsFacade
  • EventFacade
  • LocationFacade
  • MediaPlayerFacade
  • MediaRecorderFacade
  • PhoneFacade
  • PreferencesFacade
  • SensorManagerFacade
  • SettingsFacade
  • SignalStrengthFacade
  • SmsFacade
  • SpeechRecognitionFacade
  • TextToSpeechFacade
  • ToneGeneratorFacade
  • UiFacade
  • WakeLockFacade
  • WebCamFacade
  • WifiFacade


Title: rpc server test for the notify method
Post by: kryton9 on May 14, 2012, 10:16:26 pm
Here is another little test. This sends a notification to the android device.
The "localhost:xxxxx" needs the x'es replaced with your RPC server port number.
Code: [Select]
OPEN "localhost:xxxxx" FOR SOCKET AS #1
PRINT #1,"{id:1,method:notify,params:[\"ScriptBasic\",\"The message for the notification\"]}"
Title: Re: ScriptBasic for Android
Post by: Support on May 14, 2012, 10:27:39 pm
Glad to see you talking to the Droid.  :D

It might be easier and more readable if you change this code ...
Code: [Select]
PRINT #1,"{id:1,method:notify,params:[\"ScriptBasic\",\"The message for the notification\"]}"

to something like this. This follows the JSON string declaration more closely. (even though it doesn't seem to matter)
Code: [Select]
PRINT #1,"""{"id":1,"method":"notify","params":["ScriptBasic","The message for the notification"]}\n"""

Hint: Don't forget the \n at the end of your JSON messages to the server. The response contains a linefeed so you will want to use CHOMP() to remove it before passing it to JSON2SB().
Title: Re: ScriptBasic for Android
Post by: kryton9 on May 14, 2012, 11:35:38 pm
John, are we going to develop these facades and then you will put them into 1 module?

I will try the webcam facade tonight and send you what I come up with based on your user functions code.
Title: Re: ScriptBasic for Android
Post by: Support on May 15, 2012, 12:24:35 am
You are going to have to do your testing in a top/down script at the moment. (no functions or subs)

I'm going ahead with building the DVM module on Ubuntu and running it from there. (until SB Android is fixed)

Title: PC to Tablet Test Fail
Post by: kryton9 on May 15, 2012, 01:20:57 am
I tried what you wrote about earlier John, going from pc to android device(tablet).
I installed sl4a release 5 as that has the fixed port setting option that the release I had didn't have.

In my server list it shows the public server as: 1%1:42241
It doesn't show the actual public ip. But I know from my router and from the ping result that it is
192.168.1.101

My stuff I send or run for the android device is in a subfolder I named 4d(short hand for droid) in my root ScriptBasic folder.
The open command gives an error. It is the same error I had before in testing when the port was not correct. In this case, I wonder if that %1 that is assigned instead of an ip is the problem?

On another note in the SB help, I can't find anything for SOCKET or MODULE, are these new commands?
Title: Re: ScriptBasic for Android
Post by: Support on May 15, 2012, 01:35:45 am
I haven't tried the remote SL4A option yet and will do so tonight.

SOCKET (http://www.scriptbasic.org/docs/ug/ug_13.1.html)

MODULE (http://www.scriptbasic.org/docs/ug/ug_11.html)

Title: Re: ScriptBasic for Android
Post by: kryton9 on May 15, 2012, 03:00:27 am
Thanks I was using the users guide that came with the download, the web one is bookmarked for future use, thanks.

I tried doing the android example with my pc to tablet with a public server and it gave an error too:
http://code.google.com/p/android-scripting/wiki/RemoteControl

You can see the results and how I followed the tutorial in the screenshot.



Title: python to tablet private server, worked!
Post by: kryton9 on May 15, 2012, 03:20:42 am
python to tablet private server, worked!
Title: Re: ScriptBasic for Android
Post by: Support on May 15, 2012, 03:44:47 am
The million dollar question is what is the IP to use in scriba?

Title: Re: ScriptBasic for Android
Post by: Support on May 15, 2012, 04:17:50 am
Get the latest development release, 5x18.

http://code.google.com/p/android-scripting/wiki/Unofficial

This will show the IP and not ::1%1.

The server hangs on the OPEN from scriba on Ubuntu using the IP:PORT given. (public server)

Title: without recent updates, but a working structure:WORKING!!! with update
Post by: kryton9 on May 15, 2012, 04:30:51 am
John, I will get the updates, but I know my ip is correct from my router.
After having success with the python tutorial, I tried to mimic it with sb.

I have my tablet hooked via usb and setup a private server just as in python.
I wrote a cmd file(running in windows7) to make it easier to make changes.
It is in the attachment. You can make changes as needed for your system.

The sb2d.cmd I put in my E:\android-sdk-windows\platform-tools

The 2 sb scripts are in my E:\ScriptBasic\4d  
this is also where my sciba is located.
UPDATE:
WOOHOO! after getting the latest sl4a you linked too, it is all working now. I made no changes to the attached files. Just make sure you are on the home screen so you can see the output. When you are looking at the server info, the message doesn't show up.



Update2: it now works also without the usb cable attached :)

Update 3: I did a restart on my pc and skipped all the adb stuff (usb cable not used), I didn't do any of the set AP_ commands and just ran scriba hello2v2.sb  and it worked over the internet and wireless!!

Update 4:  Did a full shutdown of the public server and my tablet. Did a full shutdown on my PC. After powering both up and starting a new public server via sl4a it worked just fine with scriba hello2v2.sb command line issued!
Title: Re: ScriptBasic for Android
Post by: Support on May 15, 2012, 05:23:40 am
Under Ubuntu Linux running the Android emulator provided with the SDK, it just hangs on the OPEN for both private (with port forwarding) and public connections.

I have a message out on the Android Scripting list asking Robbie what's up.
Title: Re: ScriptBasic for Android
Post by: Support on May 15, 2012, 06:14:59 am
Finally!

I ran into a post on some forum and it said that the RPC server only listens on the loopback (127.0.0.1) port under Linux. That was the hint that got me pointed in the right direction. I still had to do the adb port forwarding. I have the default sever port set to be 9999. (pref.) I issue the following adb command in my Ubuntu terminal.

jrs@laptop:~$ adb forward tcp:9999 tcp:9999

This way I don't have to touch a thing if I'm running remote or on the sdcard.

Code: [Select]
OPEN "localhost:9999" FOR SOCKET AS #1
PRINT #1,"""{"id":1,"method":"getPhoneType","params":[]}\n"""
LINE INPUT #1, r
PRINT r

jrs@laptop:~/sb/test$ scriba phonetype.sb
{"error":null,"id":1,"result":"gsm"}
jrs@laptop:~/sb/test$


I can see an advantage of running a SB script on a desktop that accesses a MySQL or ODBC database and updates an Android phone or pad with new contacts or even SQLite DBs on the device. The concept of write once, run anywhere is leaning toward using scripting language solutions. Python is in the lead but has a size and dependency downside. I hope the simplistic nature of traditional Basic and the versatility to run anywhere will give ScriptBasic a purpose on a mass scale.
Title: Re: ScriptBasic for Android
Post by: kryton9 on May 15, 2012, 02:59:08 pm
Glad you got it working under Linux.
Title: Re: ScriptBasic for Android
Post by: Support on May 18, 2012, 04:48:23 am
For those wondering what a Facade is.

Quote
If you go to the SL4A API one of the things you notice is the word Facade at the end of each API.  Facade refers to a software design pattern.  A software design pattern is a generic reusable solution to a problem that occurs in a specific context in software design.  So, a facade software design pattern, represented by a facade is an object that provides a simplified interface to a larger body of code, like a class library.  As a developer you might want to do this to make the library more readable, and reduce dependencies of code on the inner workings of a given library.  In our case, the facade object is Android, and it provides a single, simple interface to the Android SDK, which is huge (relatively speaking).  The Android facade object provides a simple interface to a number of things including battery manager, camera functionality, media player, settings api, speech recognition api, web cam functionality just to name a few things.
Title: Benchmarking
Post by: kryton9 on May 20, 2012, 06:12:26 pm
Updated the attachment to the latest working python and scriptbasic scripts for benchmarking. Thanks to John's help.

John, I started to do some benchmarking, but am getting errors I can't figure out why in Scriptbasic being a noob to the language.

It is based on code here:http://onlyjob.blogspot.com/2011/03/perl5-python-ruby-php-c-c-lua-tcl.html

The benchmark as written takes too much time, so I modified it to stop after 2 results.
Here is the python script that I tested on my gaming notebook and on my android tablet.
Code: [Select]
#!/usr/bin/python -u
import re
import time
import sys

str='abcdefgh'+'efghefgh'
imax=1024/len(str)*1024*4   # 4mb

starttime=time.time();
print "exec.tm.sec\tstr.length"

gstr=''
i=0
twice = 0
while (i < imax+1000):
        i=i+1
        gstr+=str
        gstr=re.sub('efgh','____',gstr)
        lngth=len(str)*i
        if(lngth % (1024*256) == 0):
                print int(time.time()-starttime),"sec\t\t",(lngth/1024),"kb"
twice+=1
if(twice == 2): break # don't want to wait for the whole test

print "\nFinished"

Here is as far as I could get in SB port:
Code: [Select]
s ="abcdefgh"+"efghefgh"
imax = 1024 / LEN(s) * 1024 * 4

starttime = NOW
PRINT "exec.tm.sec\tstr.length"

gstr=""
i=0
c = 0
WHILE ( i < imax + 1000 )
        i=i+1
        gstr+=s
        gstr=REPLACE(gstr,'efgh','____')
        lngth=LEN(s)*i
        IF(lngth % (1024*256) = 0) THEN
                PRINT INT(NOW -starttime),"sec\t\t",(lngth/1024),"kb"
c+=1
IF c= 2 THEN GOTO finito' don't want to wait for the whole test
        END IF
WEND

finito:
PRINT "\nFinished"

Results of the python tests:
Gaming Notebook Python 2.6:
exec.tm.sec     str.length
3 sec           256 kb
15 sec          512 kb

Android Tablet sl4a Python:
exec.tm.sec     str.length
36 sec           256 kb
157 sec          512 kb
Title: Re: ScriptBasic for Android
Post by: Support on May 20, 2012, 06:46:29 pm
Don't forget to use & not + for string concatenation. It seems that imax is some kind of reserve keyword. SB doesn't support single quote for declaring strings.

Code: [Select]
s ="abcdefgh" & "efghefgh"
i_max =  1024 / LEN(s) * 1024 * 4

starttime = NOW
PRINT "exec.tm.sec\tstr.length\n"

gstr=""
i=0
c = 0
WHILE ( i < i_max + 1000 )
        i=i+1
        gstr&=s
        gstr=REPLACE(gstr,"efgh","____")
        lngth=LEN(s)*i
        IF(lngth % (1024*256) = 0) THEN
                PRINT INT(NOW -starttime)," sec\t\t",(lngth/1024)," KB\n"
c+=1
IF c= 2 THEN GOTO finito
        END IF
WEND

finito:
PRINT "\nFinished\n"

jrs@laptop:~/sb/test$ scriba kentbench.sb
exec.tm.sec   str.length
107 sec      256 KB
436 sec      512 KB

Finished
jrs@laptop:~/sb/test$

Please check the code to make sure the SB version is doing the same as the other languages.

Python test on my laptop:

jrs@laptop:~/sb/bench$ python pstr.py
exec.tm.sec   str.length
9 sec      256 kb
50 sec      512 kb

Finished
jrs@laptop:~/sb/bench$

I wonder how this would run under BaCon?
Title: Re: ScriptBasic for Android
Post by: kryton9 on May 21, 2012, 03:32:54 am
Thanks John for finding the problems in the test script and making a nice working script.

Here are my results:

Gaming Notebook scriba bm.sb
exec.tm.sec     str.length
27 sec           256 KB
107 sec         512 KB

Gaming Notebook Python 2.6:
exec.tm.sec     str.length
3 sec            256 kb
15 sec          512 kb

Android Tablet scriba bm.sb
281 sec        256 KB
1148 sec        512 KB

Android Tablet sl4a Python:
exec.tm.sec     str.length
36 sec           256 kb
157 sec          512 kb
Title: Re: ScriptBasic for Android
Post by: Support on May 21, 2012, 04:47:28 am
I solved the problem with REPLACE and happy with the results.

Quote
Test code grows text string by adding another string in cycle until it grows up to 4 mb. Each iteration substitutes some text. Every time string becomes 256 KiB larger program prints number of seconds passed since beginning of test.


Code: [Select]
s ="abcdefghefghefgh"
i_max =  1024 / LEN(s) * 1024 * 4

starttime = NOW
PRINT "exec.tm.sec\tstr.length\n"

gstr=""
i=0
c = 0
WHILE ( i < i_max + 1000 )
  i=i+1
  gstr&=s
  lngth=LEN(s)*i
  gstr=REPLACE(gstr,"efgh","____",undef,lngth-16)
  IF(lngth % (1024*256) = 0) THEN
    PRINT INT(NOW -starttime)," sec\t\t",(lngth/1024)," KB\n"
    c+=1
    IF c= 2 THEN GOTO finito
  END IF
WEND

finito:
PRINT "\nFinished\n"

jrs@laptop:~/sb/test$ scriba kentbench.sb
exec.tm.sec   str.length
5 sec      256 KB
34 sec      512 KB

Finished
jrs@laptop:~/sb/test$

Code: [Select]
abcd____________

abcd____________abcd____________

abcd____________abcd____________abcd____________

abcd____________abcd____________abcd____________abcd____________

I compiled the C version for a reference base. (1st MB)

jrs@laptop:~/sb/bench$ ./cstr
exec.tm.sec   str.length
2sec      256kb
6sec      512kb
17sec      768kb
34sec      1024kb
^C
jrs@laptop:~/sb/bench$
Title: Re: ScriptBasic for Android
Post by: kryton9 on May 21, 2012, 07:54:53 pm
Nice updates John. The author of the benchmarks wrote that he wasn't going for optimization's and trying to keep the code uniform across all languages. But it is interesting to see how you did your improvements.
I did the java test on the notebook. It runs through eclipse, but not stand alone.
notebook:
exec.tm.sec   str.length
8sec      256kb
34sec      512kb

To run you need to unzip the attachment into your eclipse workspace folder and open it from the project menu in eclipse and then run.
Title: Re: ScriptBasic for Android
Post by: Support on May 22, 2012, 12:23:13 am
Kent,

I don't have Eclipse installed and don't want to trash my development system with installing Java and all the other dependencies that go with it. I'll take your word on the results and factor the numbers based on your Python run on your gaming netbook.

John
Title: Re: ScriptBasic for Android
Post by: kryton9 on May 22, 2012, 12:43:16 am
I understand John, in fact it is so screwy now with Java. You have Java and OpenJava, there is version 6 the stable release and 7 which has quirks. I never cared for Eclipse, too me it is buggy compared to other IDE's I use. I just installed it to tinker with Android and what you are doing with SB and Android. I personally am not happy with Android, it is not what I expected. For a phone it is fine, but for a true cross platform OS, it doesn't have the right foundation in my book.

I just look at my tablet as a media source at bedtime anymore. It is not the development toy I thought it was going to be.
Title: Re: ScriptBasic for Android
Post by: Support on May 22, 2012, 01:07:21 am
Quote
I just look at my tablet as a media source at bedtime anymore. It is not the development toy I thought it was going to be.

Don't give up so soon. You haven't even played with the GUI yet. (fullscreen, controls, events, ...) The SQLite3 Facade is coming from what I have been told. I plan to use SB Android on a pad with an open source medical practice package as the input device.

Check out the Android Framework PDF I attached.
Title: Re: ScriptBasic for Android
Post by: Support on May 22, 2012, 06:16:05 pm
I was checking into Android emulators that support tablet size screens and physical controls. I was happy to learn that I could create an AVD  and specify device characteristics.

I found this (http://developer.android.com/guide/practices/screens_support.html) in the Android Developer Guide that might help with GUI layout and design strategies.
Title: Re: ScriptBasic for Android
Post by: kryton9 on May 22, 2012, 07:23:47 pm
Thanks for the links John. My interest as you might know currently is in game development and possible future work with robotics, the pc is still the platform for me.

I do like my tablet for reading, surfing and watching videos while trying to get to sleep :)
Title: Re: ScriptBasic for Android
Post by: Support on May 22, 2012, 07:33:54 pm
I want to thank you for being one of the first to join in on the bleeding edge of Android (remote) scripting. I think ScriptBasic has an advantage due to it's small footprint and ease of use. Allowing weekend programmers to script their devices to their needs from anywhere is bound to attract attention. It's still early and the DVM extension module in it's infancy. It would be great to see the ScriptBasic project grow with users and developers.

BTW

The SB dev team has two directions going with the ARM version of ScriptBasic. Steve is working on a native ARM compile of SB while Armando is using the Android NDK. Steve has isolated the looping FUNCTION/SUB issue to an assembler bug in the toolchain.
Title: Re: ScriptBasic for Android
Post by: Support on May 23, 2012, 06:16:10 pm
Quote
My interest as you might know currently is in game development and possible future work with robotics, the pc is still the platform for me.

(http://i.zdnet.com/blogs/app_asteroiddefense_90.jpg) (https://play.google.com/store/apps/details?id=com.deonn.games.ad2)

(http://i.zdnet.com/blogs/app_systempanel.png) (https://play.google.com/store/apps/details?id=nextapp.systempanel.r1)

iGuess you only have one Apple left in the basket.  :(
Title: Re: ScriptBasic for Android
Post by: kryton9 on May 25, 2012, 03:22:45 am
Cool screenshot John.

Android gained market share as symbian and blackberry lost some.
http://www.bgr.com/2012/05/24/android-ios-market-share-q1-2012-blackberry-idc/ (http://www.bgr.com/2012/05/24/android-ios-market-share-q1-2012-blackberry-idc/)

Arm is soon going to be in the new Arduino, already is in the beaglebone and soon to be available rasberry pi. Everything is changing at such a pace!
http://www.wired.com/gadgetlab/2011/09/arduino-arm-products/ (http://www.wired.com/gadgetlab/2011/09/arduino-arm-products/)

Your developers at scriptbasic are set for the future. I will still be testing stuff that you come up with. It was lots of fun going through what we did the last few weeks.


Title: Re: ScriptBasic for Android
Post by: Support on May 25, 2012, 05:45:39 am
Kent,

Thanks for helping out the ScriptBasic project and your feedback is much appreciated. I would venture to say there is still more fun still to come as this project materializes. You're a OxygenBasic fan and now a SB user. You may want to try creating one of your own extension modules with O2 for SB. I hope to get a fixed (sub/function looping issue) Android version soon.

John
Title: Re: ScriptBasic for Android
Post by: Support on May 25, 2012, 11:37:18 pm
(http://i.zdnet.com/blogs/idc052412a.png)

Quote
If you’re a challenger to the Android-Apple tag team these IDC standings are simply depressing.

Windows Mobile/Windows Phone has yet to make significant inroads in the worldwide smartphone market, but 2012 should be considered a ramp-up year for Nokia and Microsoft to boost volumes. Until Nokia speeds the cadence of its smartphone releases or more vendors launch their own Windows Phone-powered smartphones, IDC anticipates slow growth for the operating system.

With Android owning more then half the market, scripting phones/tablets (local and remote) may make ScriptBasic more attractive.

Even on my old Acer Aspire 5000, ScriptBasic loads, initializes and process the PRINT script in .006 seconds.

Code: [Select]
PRINT

jrs@laptop:~/sb/test$ time scriba prtpgm.sb


real   0m0.006s
user   0m0.004s
sys   0m0.000s
jrs@laptop:~/sb/test$

About the same time as it takes light to travel one mile in a vacuum.

Title: Re: ScriptBasic for Android
Post by: kryton9 on May 27, 2012, 05:24:23 am
John, yes the numbers are interesting. It will be interesting to see how Windows 8 progresses and effects things in the next 2 years.

Here is something that surprises me, that is C ranking #1 for a very long time, except for a short while.
http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html (http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html)
You have to scroll down to the "Very Long Term History" section on the page. Basically #1 since 1987. That just amazes me.

Another language that surprises me is Perl. It has been around in the top languages forever and I think has the most libraries of any language out there.
I never learned it or played with it, but the syntax is not bad looking from the example code I have seen.
Title: Re: ScriptBasic for Android
Post by: Support on May 27, 2012, 07:22:30 pm
When Peter Verhas was developing ScriptBasic, (late 90s) he was using C and Perl at the time. Python hadn't made it's mark yet but if you look closely at the SB code, it will be sprinkled with both Perl and Python concepts complementing the traditional BASIC syntax.
Title: Re: ScriptBasic for Android
Post by: Support on May 31, 2012, 04:09:03 am
Robbie Matthews that manages the Google Groups Android scripting list (https://groups.google.com/group/android-scripting?hl=en) has a book out that might interest Android tablet developers.

Quote
Robbie Matthews gives a full, no-holds barred introduction to Android programming for tablets. No previous experience required!

(http://www.apress.com/media/catalog/product/cache/9/image/9df78eab33525d08d6e5fb8d27136e95/A/9/A9781430237839-3d_2.png)

more ... (http://www.apress.com/9781430237839)
Title: Re: ScriptBasic for Android
Post by: kryton9 on June 02, 2012, 05:40:05 am
I think windows 8 is going to effect Android market share, at least if this post is true.
http://www.kernelmag.com/comment/opinion/2432/no-but-for-reals/ (http://www.kernelmag.com/comment/opinion/2432/no-but-for-reals/)
Title: Re: ScriptBasic for Android
Post by: Support on June 02, 2012, 06:15:54 am
I don't think people can afford to be loyal to the Microsoft morphing monster any longer. They are broken and Steve isn't the person to fix it.

Who would of thought PHP would have been as popular as it is?
Title: Re: ScriptBasic for Android
Post by: kryton9 on June 02, 2012, 08:02:49 pm
PHP once you use it for awhile is not bad. It just takes a few days to get used to it. I spend a few weeks setting up a webserver from my home to see how it all worked about 8 years ago and really got into it PHP hot and heavy then and was impressed that you could do so much with it and javascript. But I just didn't have a fast enough upload bandwidth to use it. So I moved over to web hosted servers.

It will be interesting to see how things shake out the next 2 years. I am sure Google is working behind the scenes to get over the non unified world of android out there. I do get a lot of errors on my android devices, but luckilly it just crashes the app and not the whole device.
Title: ScriptBasic for Android - SL4A (r5x21)
Post by: Support on June 04, 2012, 09:32:09 am
Release Notes: r5x21 4-Jun-2012



Updated API Ref (http://code.google.com/p/android-scripting/wiki/unofficial_apiref)
Title: ScriptBasic for Android - SL4A Tablet Remix
Post by: Support on June 04, 2012, 10:01:52 am
Quote from: Liam Green-Hughes
Hi everyone,

I have had a go at making a version of SL4A that is for Android Honeycomb devices, especially the Asus EEE Pad Transformer. The APK for my version is attached and the source code and change history can be found at: http://code.google.com/r/liamgreenhughes-sl4a-tf101/. This version is designed to fit in with the whole Honeycomb user experience so you will notice that it looks a bit different. Some functions have been extended to add support for some of the features found on these devices such as the front camera, high-def video and the extra battery in the EEE Pad's keyboard. Some screenshots are below. The Triggers functionality doesn't quite work properly yet but the rest should be usable.

Comments and feedback very welcome!

Download & more ... (http://www.greenhughes.com/content/sl4a-tablet-remix-release-announcement)

Honeycomb Screenshot

(https://lh4.ggpht.com/5PTux0uWFeZUSD16YGbYHKilw6aq-SGUWrMKR2ggXCE6LPIssZXISN-27ZgEFwgbzrw=h230)
Title: Re: ScriptBasic for Android
Post by: kryton9 on June 05, 2012, 05:04:05 am
Thanks John for the info. I get confused too easily anymore jumping from language to language and system to system. I still get into the mood every so many months, but the old mind is not as cooperative as it was 10 years ago :)

First time in my life, I hope Microsoft gets version 8 right to unify truly once and for all multi-device development. But they seem to do things to shoot themselves in the foot quite often. Already signs of it with no opengl support for arm devices, at least so far.

Title: Re: ScriptBasic for Android
Post by: Support on June 09, 2012, 04:29:01 am
I found this SL4A API Help Guide (http://www.mithril.com.au/android/doc/index.html) that might be worth having a peek at.

Title: Re: ScriptBasic for Android
Post by: Support on June 09, 2012, 09:37:55 pm
Dr. AIR comes through again and finds the solution to bringing ScriptBasic extension modules to life on Android Linux. (NDK)

(http://files.allbasic.info/ScriptBasic/extmod.png)

Title: Re: ScriptBasic for Android
Post by: kryton9 on June 10, 2012, 05:59:12 am
Nice to see your team making progress John. Thanks for the updates.
Title: Re: ScriptBasic for Android
Post by: Support on June 10, 2012, 07:56:05 am
Here are a few more extension module calls to the t.so (tools) and ux.so (unix specific) functions.

t_xml.sb
Code: [Select]
declare command XML alias "xmlserialize" lib "/data/data/org.scriptbasic/t.so"

a{"Name"}="John"
a{"Age"}=59

print XML(a),"\n"

t_md5.sb
Code: [Select]
declare sub MD5 alias "md5fun" lib "/data/data/org.scriptbasic/t.so"

m = MD5("JRS")
print "0 |1 |2 |3 |4 |5 |6 |7 |8 |9 |A |B |C |D |E |F |\n"
for x = 1 to len(m)
  print right("0" & hex(asc(mid(m,x,1))),2) & "|"
next
printnl

ux_fork - I was surprised that Android allowed forking a child process.
Code: [Select]
declare sub uxfork alias "uxfork" lib "/data/data/org.scriptbasic/ux.so"

pid = uxfork()

IF pid THEN
  PRINT "Created a child process with a PID of ",pid,"\n"
ELSE
  PRINT "This is a child process with the PID of ",pid,"\n"
END IF

LINE INPUT x

(http://files.allbasic.info/ScriptBasic/androidx.png)
Title: Re: ScriptBasic for Android
Post by: Support on June 12, 2012, 02:12:47 am
I put Bertha the blow up Android emulator in the closet and got the real thing.  :o

(http://static.stuff.co.nz/1338530723/776/7031776.jpg)

Galaxy Tab 2 10.1 (http://www.samsung.com/global/microsite/galaxytab2/10.1/index.html?type=find)

Title: Re: ScriptBasic for Android
Post by: Support on June 12, 2012, 08:42:04 pm
I'm only developing the SL4A interface for Android 4.x based devices. I'm putting together a procedure on SB Google Code that will be a tutorial of sorts on how to install ScriptBasic (scriba and it's extension modules) on an un-rooted device. Scriba should run on earlier versions of Android regardless.

Title: Re: ScriptBasic for Android
Post by: kryton9 on June 13, 2012, 06:09:44 pm
Quote
I put Bertha the blow up Android emulator in the closet and got the real thing. 
John, I love your sense of humor!

Congratulations on your wonderful tablet. I think you got the best one out right now, so happy developing and testing on this beauty!
Title: Re: ScriptBasic for Android
Post by: Support on June 13, 2012, 09:19:27 pm
Disclamer

At this point I'm not planning on rooting my Galaxy Tab 2 10.1 device. I find it more of a challenge to create a usable Linux terminal environment and still keep the device a virgin. I'm having fun finding out what the SGT2 can offer to scripting language environments like Python and SB. I think ScriptBasic has a fair chance at people taking the language seriously and using it to glue (customize) their digital world.

Quote from: Ultimate Android Guide (http://www.justrehhoff.org/ultimate-android-guide-2-flash-a-custom-rom-achieving-root-access/)
Root Access - SGT2

Root is similar to Apple Iphone’s Jailbreak. Thus Jailbreak gives the user the ability to change theme, download apps from 3rd party app stores – it still doesn’t give you that amount of power that you’ve achieve when rooting your device.
As i’ve said in the previous article – this is at your own risk!

(http://www.justrehhoff.org/wp-content/uploads/2012/03/warning1-300x225.png)

This is for the Samsung Galaxy Tab! – In order to achieve root on this device, you must first synch it with kies, then disconnect it, then enable USB debugging mode and the launch an homebrewed program called “SuperOneClick” – with that press “ROOT” and you’re rooted! However you’ve still doesn’t have any Custom Kernel or recovery system installed at the moment, this can be done by using the software called “ODIN”.

As you can see – the Samsung device is A LOT easier to Root than the HTC device. This generally applies to all HTC’s and Samsung Devices.

1)      Install Samsung Kies – this is used for installing the necessary drivers that we are going to use for the Samsung Galaxy Tab.

2)      Synchronize your Tablet with Kies, just once would be enough to install the drivers. Disconnect the Tablet. Please ensure that you’ve doesn’t use any other launcher other than the default Touchwizz launcher! Many have reported that the Tablet won’t synchronize, but that’s just due to Samsung that have made the software capable of only detecting the device when running the default launcher/home replacement.

“It is important to install the drivers correctly in order to have any communication with the device. The method for HTC devices is similar as the Samsung devices.”
Title: Re: ScriptBasic for Android
Post by: kryton9 on June 14, 2012, 04:14:14 am
Don't get caught up in all the rooting hype. I am glad I didn't root my tablet and although I like the stuff on my rooted phone, it is not stable and if I could go back to the stock ROM I would. It is just so easy to get caught up with it reading the articles and watching the videos on youtube.  Just look at that red sign you got in your post. Those will keep you out of trouble and happier!
Title: Re: ScriptBasic for Android
Post by: Support on June 15, 2012, 09:36:56 am
I haven't run into any show stoppers so far getting SB installed on my SGT2_10.1 Android device. I was able to get scriba to generate configuration files where I wanted them to go.

(http://files.allbasic.info/ScriptBasic/sbconf.png)

Notice the short lib name?

(http://files.allbasic.info/ScriptBasic/sbconf2.png)


Here are a few apps I installed to make my life easier.

ConnectBot (http://code.google.com/p/connectbot/)

(http://files.allbasic.info/ScriptBasic/botcon.png)


DroidEdit (http://droidedit.wordpress.com/)

(http://files.allbasic.info/ScriptBasic/DroidEdit.png)

I would highly recommend Hacker's Keyboard (http://code.google.com/p/hackerskeyboard/) as your virtual keyboard alternative.

Code: [Select]
IMPORT DVM

PRINT "Phone Type: ",DVM::getPhoneType(),"\n"
PRINT "Screen Brightness: ",DVM::getScreenBrightness(),"\n"
PRINT "Airplane Mode: ",DVM::checkAirplaneMode(),"\n"
PRINT "Ringer Silent Mode: ",DVM::checkRingerSilentMode(),"\n"
PRINT "Screen On: ",DVM::checkScreenOn(),"\n"
PRINT "Max Media Volume: ",DVM::getMaxMediaVolume(),"\n"
PRINT "Max Ringer Volume: ",DVM::getMaxRingerVolume(),"\n"
PRINT "Media Volume: ",DVM::getMediaVolume(),"\n"
PRINT "Ringer Volume: ",DVM::getRingerVolume(),"\n"
PRINT "Vibrate Mode: ",DVM::getVibrateMode(),"\n"
PRINT "Vibrate Mode Ringer: ",DVM::getVibrateMode(TRUE),"\n"
PRINT "Vibrate Mode Notify: ",DVM::getVibrateMode(FALSE),"\n"

(http://files.allbasic.info/ScriptBasic/DVM_ext.png)

Note:  The size of this last image is very close to my actual screen size for the tablet. (based on my laptop 1280x800 screen)

Title: Re: ScriptBasic for Android
Post by: Support on June 16, 2012, 04:37:17 am
Don't get caught up in all the rooting hype. I am glad I didn't root my tablet and although I like the stuff on my rooted phone, it is not stable and if I could go back to the stock ROM I would. It is just so easy to get caught up with it reading the articles and watching the videos on youtube.  Just look at that red sign you got in your post. Those will keep you out of trouble and happier!

If your want to play root, do it in an emulator to see what you're unable to on the stock device. I'm pondering why sudo (or it's mechanism to allow temporary root functionality) can't be added/enabled on this open source OS. I'm sure there are certain Android applications that are purchased from the marketplace that need root functionality to install. It's hard to believe this functionality isn't available and forces users to burn a new OS image and voiding the warranty. Why doesn't device manufactures just allow root by default and provide a factory reset option that restores the device like it was when you took it out of the box. (doing a backup first would be wise)

(http://files.allbasic.info/ScriptBasic/adbot.png)
Title: Re: ScriptBasic for Android
Post by: Support on June 17, 2012, 05:30:45 am
I got tired of sharing the screen with the keyboard when at my desk so I got a Logitech® Bluetooth® keyboard (http://www.logitech.com/en-us/tablet-accessories/keyboards/tablet-keyboard-android) and the case acts as a stand.

(http://www.logitech.com/assets/41899/2/does-double-duty.png)

Quote from: product feedback comment
Just bought the keyboard at a frys after looking at the Samsung Galaxy Tab 10.1 keyboard dock (which is pretty ugly and from that the reviews say does not even work all the time). So far this baby is one of the best keyboards I've used and makes typing a pleasure on the my galaxy tab 10.1. I would recommend it to anyone planning on doing much typing on their tablet.

I was worried I was going to have to install a null virtual keyboard so it wouldn't pop up all the time. Android 4.x is smart enough to know you have an external KB attached and keeps the virtual one at bay unless you force it to be displayed by taping on the keyboard icon. Just like a PC, if I press a key while it is asleep the screen turns on like I pressed the power button. (Sweet !)

I created a new Android image for the emulator that matches my SGT2_10.1 screen size. I use a window scale .80 to allow the emulator to take the same screen real estate on my laptop as it does physically.

Laptop = 15" screen
Tablet = 10" screen

It's convent that the the tablet and my laptop both run at 1280 x 800 resolution. (tablet has better pixel density) Xfinity TV (Comcast On-Demand) runs great on the tablet and it's like having your TV in your hand. You can also use the tablet to view channel line-up and program your DVR. (both Android free apps)


Title: Re: ScriptBasic for Android
Post by: Support on June 17, 2012, 08:51:44 pm
When I started looking for a Android tablet and settled on the Samsung Galaxy Tab 2 10.1, my next decision was broadband mobility. I could buy the unit from one of the carriers (AT&T, Verizon, ...) or save a lot of money and get the 4G compatible WIFI version. (from Costco) As long as I'm home and connect via WIFI to my Comcast router (21 MBits/sec) or at Starbucks via their AT&T 4G WIFI, I still had a leash. If I would have purchased one of the carrier units, I still had to sign up for their data plan @ $50 / month. (5 GB)  

The solution I went with is the AT&T Mobile Hotspot Elevate 4G (http://www.pcmag.com/article2/0,2817,2393598,00.asp) ($119 for the modem, $50 /5 GB, 2 yr. contract, $35 activation & shipping)
 
(http://img.simplyinteractiveguides.com/664/i9228_attelevate4gproductshot.jpg)

Quote
Experience 4G LTE speeds on all your Wi-Fi enabled devices. AT&T Mobile Hotspot Elevate 4G connects up to five Wi-Fi enabled devices to the Internet with speeds up to 10x faster than 3G. With no software to install and an LCD screen to guide you, setup is fast and intuitive. Just turn on the device and connect your laptop (or another Wi-Fi enabled device) over Wi-Fi. AT&T Mobile Hotspot Elevate 4G helps you get the information you need quickly while away from your home or office, even when traveling abroad.
Title: Re: ScriptBasic for Android
Post by: kryton9 on June 18, 2012, 12:47:57 am
I am sorry I forgot to mention about Hacker's keyboard. That is my favorite that I have found so far too. But I agree, nothing compares to having an actual keyboard.
I didn't know about droidedit. That looks nice. But I am not using my tablet for coding, just media viewer and reader for bedtime now.

Your bluetooth keyboard and your case as stand for your tablet looks like a very sweet combo, congrats!

That is really nice that you are documenting your experience along the way. This kind of info is very helpful when researching. So I am sure many people will find this info beneficial when doing searches.

Title: Re: ScriptBasic for Android
Post by: Support on June 26, 2012, 07:30:23 am
I added an ANSI screen attribute library to ScriptBasic. It runs fine on both Ubuntu and Android Linux.

(http://files.allbasic.info/ScriptBasic/ademo_android.png)

Scripting the Android device remotely on Ubuntu.

(http://files.allbasic.info/ScriptBasic/ademo_ubuntu.png)

Code: [Select]
' SL4A and console screen mnemonics demo

IMPORT DVM
INCLUDE "ansi.inc"

CLS

PRINT GRAPHICS_ON
PRINT "l",STRING(38,"q"),"k"
FOR i = 2 TO 15
  PRINT AT(1,i),"x",AT(40,i),"x"
NEXT i
PRINTNL
PRINT "m",STRING(38,"q"),"j"
PRINT AT(1,3),"t",STRING(38,"q"),"u"
PRINT AT(30,3),"w"
FOR i = 4 TO 15
  PRINT AT(30,i),"x"
NEXT i
PRINT AT(30,i),"v"
PRINT GRAPHICS_OFF

PRINT AT(2,2),BOLD,COLOR(7,4,STRING(10," ") & "SAMSUNG Tab 2 10.1" & STRING(10," "))
PRINT AT(2,4),BOLD,COLOR(7,6," Phone Type" & STRING(17," "))
PRINT AT(2,5),BOLD,COLOR(7,6," Screen Brightness" & STRING(10," "))
PRINT AT(2,6),BOLD,COLOR(7,6," Airplane Mode" & STRING(14," "))
PRINT AT(2,7),BOLD,COLOR(7,6," Ringer Slient Mode" & STRING(9," "))
PRINT AT(2,8),BOLD,COLOR(7,6," Screen On" & STRING(18," "))
PRINT AT(2,9),BOLD,COLOR(7,6," Max Media Volume" & STRING(11," "))
PRINT AT(2,10),BOLD,COLOR(7,6," Max Ringer Volume" & STRING(10," "))
PRINT AT(2,11),BOLD,COLOR(7,6," Media Volume" & STRING(15," "))
PRINT AT(2,12),BOLD,COLOR(7,6," Ringer Volume" & STRING(14," "))
PRINT AT(2,13),BOLD,COLOR(7,6," Vibrate Mode" & STRING(15," "))
PRINT AT(2,14),BOLD,COLOR(7,6," Vibrate Mode Ringer" & STRING(8," "))
PRINT AT(2,15),BOLD,COLOR(7,6," Vibrate Mode Notify" & STRING(8," "))

PRINT AT(33,4),DVM::getPhoneType()
PRINT AT(33,5),DVM::getScreenBrightness()
IF DVM::checkAirplaneMode() = "false" THEN
  PRINT AT(33,6),COLOR(1,0,"false")
ELSE
  PRINT AT(33,6),COLOR(2,0,"true")
END IF
IF DVM::checkRingerSilentMode() = "false" THEN
  PRINT AT(33,7),COLOR(1,0,"false")
ELSE
  PRINT AT(33,7),COLOR(2,0,"true")
END IF
IF DVM::checkScreenOn() = "false" THEN
  PRINT AT(33,8),COLOR(1,0,"false")
ELSE
  PRINT AT(33,8),COLOR(2,0,"true")
END IF
PRINT AT(33,9),DVM::getMaxMediaVolume()
PRINT AT(33,10),DVM::getMaxRingerVolume()
PRINT AT(33,11),DVM::getMediaVolume()
PRINT AT(33,12),DVM::getRingerVolume()
IF DVM::getVibrateMode() = "false" THEN
  PRINT AT(33,13),COLOR(1,0,"false")
ELSE
  PRINT AT(33,13),COLOR(2,0,"true")
END IF
IF DVM::getVibrateMode(TRUE) = "false" THEN
  PRINT AT(33,14),COLOR(1,0,"false")
ELSE
  PRINT AT(33,14),COLOR(2,0,"true")
END IF
IF DVM::getVibrateMode(FALSE) = "false" THEN
  PRINT AT(33,15),COLOR(1,0,"false")
ELSE
  PRINT AT(33,15),COLOR(2,0,"true")
END IF

PRINT AT(1,18)
LINE INPUT z

Note: All of the above screen attributes are in the form of a string. (except CLS)

ansi.inc
Code: [Select]
' Console Display Enhancement Library

SUB CLS
  PRINT "\033[2J\033[1;1H"
END SUB

FUNCTION COLOR(fg,bg,text)
  COLOR = "\033[" & (fg + 30) & ";" & (bg + 40) & "m" & text & "\033[0m"
END FUNCTION

FUNCTION AT(x,y)
  AT = "\033[" & y & ";" & x & "H"
END FUNCTION

GLOBAL CONST NORMAL = "\033[22m"
GLOBAL CONST BOLD = "\033[1m"
GLOBAL CONST UNDERLINE_ON = "\033[4m"
GLOBAL CONST UNDERLINE_OFF = "\033[24m"
GLOBAL CONST REVERSE_ON = "\033[7m"
GLOBAL CONST REVERSE_OFF = "\033[27m"
GLOBAL CONST INS = "\033[1@"
GLOBAL CONST DEL = "\033[1P"
GLOBAL CONST INS_LINE = "\033[1L"
GLOBAL CONST DEL_LINE = "\033[1M"
GLOBAL CONST GRAPHICS_ON = "\033(0"
GLOBAL CONST GRAPHICS_OFF = "\033(B"

Title: Re: ScriptBasic for Android
Post by: Support on July 10, 2012, 12:28:13 am
If you have a Bluetooth keyboard for your Android device and the CAPS is sticking for you, download Dre’s Bluetooth Keyboard.apk (http://andrea.levinge.me/?p=59) to solve the problem. It worked for my Samsung Galaxy Tab 2 10.1 using ConnectBot and SL4A TERM. I didn't notice the problem as often with e-mail and browser forms. It seems the keyboard gets out of sync with the terminal app and works in the opposite way.