1. Hirazi Blue's Avatar
    This is a deliberate repost from "the BlackBerry Support Community Forums,
    hoping I'll might get some answers here more quickly...


    As you all are probably aware, there'a free app in the Blackberry World named "Javascript shell", which, according to accompanying text "provides an interactive Javascript REPL", which would help "to explore RIM specific APIs, while developing with BlackBerry WebWorks SDK for TabletOS." There doesn't seem to be any documentation to go along with this app, making it hard to get started with the "exploring". I can't even find any mentioned of the commands specific to this shell and how one would go around running scripts through it.

    Anyone have any idea where to get more information on this app. Help would be appreciated...
    05-14-13 04:23 AM
  2. jeroen_13's Avatar
    Itvis very easy to use. Just go to developer.blackberry.combinatie and find an api You'd like to use / test.

    Also try: alert('hello')

    I'll drop some testable sample here soon
    05-14-13 04:35 AM
  3. Hirazi Blue's Avatar
    I'll drop some testable sample here soon
    That would be nice, thanks!
    05-14-13 08:08 AM
  4. Hirazi Blue's Avatar
    P.S I forgot to ask: is there any other option to do some actual scripting on the Playbook itself?
    05-14-13 12:19 PM
  5. SifJar's Avatar
    P.S I forgot to ask: is there any other option to do some actual scripting on the Playbook itself?
    What do you mean by "actual scripting"? This tools allows you to run Javascript, or there is also "Neko Javascript Runner" which lets you write longer scripts and run them (rather than running a line at a time). Neither allow you to save your script or run a previously written script.

    Another option for javascript is just to write an HTML page with the script in it and open it in the PB's browser. You can then use a text editor on the PB to edit the script between runs. (If you don't have a text editor, Ghost Commander from App World has one built in; hold down the HTML file in the file browser and then choose "Edit").

    If you aren't fussy about the language you use, you can also grab a terminal app (I recommend term48, there is also BG Shell, both free in App World) and use Python (it's preinstalled on the Playbook, but you need a terminal to access it). The command is "python3.2". There is also a python27 installed on the PB, but I haven't been able to get it to run [EDIT: Just realised it doesn't have the "execute" permission, and it doesn't seem to be possible to give it that permission]. python3.2 can either be used in interactive mode (you type a command, it gets run) by typing "python3.2", or else it can run a pre-written script with a command such as "python3.2 example.py". For writing scripts, you can again use something like Ghost Commander, or there's a terminal based text editor called "elvis" preinstalled on the PB. It's like "vi" or "vim" if you're familiar with them.

    [You can also execute a python script by making it executable (chmod +x example.py) and including as the first line of the script "#! /usr/bin/env python3.2", then using the command ./example.py]
    Last edited by SifJar; 05-17-13 at 12:57 PM.
    05-14-13 02:18 PM
  6. Hirazi Blue's Avatar
    Thanks, that's very helpful...
    05-15-13 05:46 AM
  7. Hirazi Blue's Avatar
    @SifJar (if you still visit this seemingly completed thread):
    Could you please elaborate on the "chmod" usage. Whenever I try to use this command on a file in my "shared/documents" folder (as I assumed I wouldn't have any permissions anywhere else), I still get an "Operation not permitted" error.

    On a related topic: is there a way to tell the terminal apps (Konsole/Term48/BG Shell) to start in another specific folder, say "shared/documents" for instance, so you'd not have to cd your way into there every time?
    05-17-13 10:07 AM
  8. SifJar's Avatar
    @SifJar (if you still visit this seemingly completed thread):
    Could you please elaborate on the "chmod" usage. Whenever I try to use this command on a file in my "shared/documents" folder (as I assumed I wouldn't have any permissions anywhere else), I still get an "Operation not permitted" error.

    On a related topic: is there a way to tell the terminal apps (Konsole/Term48/BG Shell) to start in another specific folder, say "shared/documents" for instance, so you'd not have to cd your way into there every time?
    Hmm, now that I think of it, I never actually changed permissions on the PB itself. I wrote a script on my PC, gave it executable permission there and THEN copied it. Maybe you can't do that on PB. Maybe it's easier to just use "python3.2 example.py"

    EDIT: You can add executable permissions in the HOME directory (i.e. the one you are in by default when you enter the terminal). So if you were creating a python script, it'd be like this:

    "elvis example.py"
    {type script}
    "chmod +x example.py"
    "./example.py"

    And if you copy an already executable file, it will also be executable. So if you have a template script (e.g. temp.py) which you have run chmod +x on, you can simply do "cp temp.py example.py" to create a new, executable script, then edit it and run it.


    As for starting in a different directory; unfortunately, I can't seem to get any of the terminal apps I have tried to recognise a configuration file. PB appears to use Korn Shell, so I tried creating a ".kshrc" in the $HOME ("~") directory (which is a folder within the app's data folder), but it ignored it. I haven't tried much other than that, if I find any way to do anything like that, I'll let you know. Personally, I tend to just work in ~ instead of cd-ing to another directory.
    Last edited by SifJar; 05-17-13 at 12:57 PM.
    05-17-13 12:39 PM
  9. Hirazi Blue's Avatar
    A belated thank you, but a thank you nonetheless...
    One more question: when you speak of altering the permissions of a file externally, you probably mean from a Linux shell only (or maybe OSX) but not Windows, or not?
    05-20-13 05:03 PM
  10. SifJar's Avatar
    A belated thank you, but a thank you nonetheless...
    One more question: when you speak of altering the permissions of a file externally, you probably mean from a Linux shell only (or maybe OSX) but not Windows, or not?
    I actually did do it on Windows, from a Cygwin shell. You can grab Cygwin from here: Cygwin Gives you a Linux-like shell in Windows. If all you want is changing permissions, you can just do a default install and not bother adding any packages during the setup process. Although this may be overkill for just setting permissions, and there is quite possibly a better way to do it. I just happened to be in a Cygwin shell at the time.
    05-20-13 05:25 PM
  11. Hirazi Blue's Avatar
    I actually did do it on Windows, from a Cygwin shell.
    Could it be this has something to do with the "fabled" root permissions of the "olden days"? Or maybe I'm just too stupid, as I can't get this (permissions in Cygwin - move to Playbook) to work.
    Anyhow: at least I found this little gem, called SH Script Runner, which allows for writing and executing scripts on-the-fly and saving and loading them.
    I don't know the policies of Crackberry concerning bar-files as attachments, but I'll just go ahead and include the version apk2bar.unker.net made for me.
    And as a newbie and as a side-note: what would be the best place to dump such finds on the off-chance that I'd be the first to notice an app?

    edit: one quirk worth mentioning - while a terminal app like Konsole allows for the issuing of (some) executable names as direct "commands" "(i.e. >python3.2), this app needs to be told exactly where the executable "lives" (i.e. >/usr/bin/python3.2). Don't know why, I plead Newbie...
    Attached Files
    Last edited by Hirazi Blue; 05-23-13 at 04:46 AM.
    05-23-13 04:34 AM
  12. SifJar's Avatar
    Nope, certainly has nothing to do with root, my PB has never been rooted.

    Anyway, that script runner sounds interesting, I'll have to give it a try. I wouldn't have thought an Android app would have worked for this sort of thing (I've tried to use various Android terminal emulators, and none have ever worked at all).

    As for why you need the full path, my guess is apps like Konsole and term48 probably setup the PATH system variable to contain folders like /usr/bin and /system/bin etc., whereas this app presumably does not. (Or at least, not for all folders...). Also, Crackberry is fine with BARs being posted (As long as the app is a free one, not warez)

    EDIT: I was right about the PATH variable, here's what it contains in SH Script Runner and term48:

    SH Script Runner: http://imm.io/media/17/173fR.png
    term48: http://imm.io/media/17/173gc.png

    [Konsole is probably pretty much the same as term48]

    If you want to be able to use commands like python3.2 without the full path, you can add a line like this to the top of your script:
    Code:
    PATH = $PATH:/usr/bin
    You can add more folders than that, just seperate each with a colon (":"). To view the path, the command is
    Code:
    echo $PATH
    EDIT: Have you been able to save and load scripts? I can't seem to save them...

    EDIT: Just realised this works for python scripts if you put the first line as "#! /usr/bin/python3.2"; perhaps this is what you meant all along, but I just figured that out, I was thinking this was just for SH scripts. That's pretty cool I guess. Also, saving randomly started working. Not sure what I did to make that happen.

    EDIT (yeah, again): OK, this is pretty neat. Good find
    Last edited by SifJar; 05-23-13 at 02:20 PM.
    Hirazi Blue likes this.
    05-23-13 01:48 PM
  13. Hirazi Blue's Avatar
    Yes, this seems to be another quirk. I was able to load a file I prepared with Jota+ and haven't yet felt the need to save anything from Script Runner. My assumption is that its default path points to a root location it thinks it's not allowed to read or write from, subsequently doing nothing, not having root permissions. If you however point it to a path in the ""shared" or "sdcard" it should work as far as I can tell... Otherwise even pasting from an editor could make it a useful tool, as that is something I haven't figured out with Konsole or term48.
    05-23-13 03:30 PM
  14. SifJar's Avatar
    Well, I did somehow make it save once or twice, but it should definitely have permission to save in that folder, it's on the Android "sd card". Subsequently, other apps can also access this folder, so another app (e.g. Ghost Commander) could be used for editing scripts. Maybe it's time for me to look for a Python editor for Android with syntax highlighting...

    EDIT: DroidEdit Free seems decent enough, here's the converted version if you're interested: DroidEdit Free.bar

    There is also a "pro" version, which allows you to run "commands" involving the file you are working on, but I cannot seem to get it to run a python script, plus it's "protected" so can't be (easily) extracted from a phone and must be found in more "shady" areas (of course, I purchased it on my Android phone first).

    EDIT: Figured out how to extract the pro version easily (using Titanium Backup) but it still seems the "external commands" function doesn't work on the PB. I tried testing it with commands like
    Code:
    echo "test"
    which works perfectly on my phone, but it does nothing on PB. Shame, if that had worked this could have been the perfect solution. Ah well, it's still a decent editor.
    Last edited by SifJar; 05-24-13 at 07:06 AM.
    05-23-13 04:12 PM
  15. Leyra B10's Avatar
    You can try the smart tags app to save a lot of time, or docs to go.

    Posted via CB10
    08-20-17 12:07 AM
  16. Leyra B10's Avatar
    Blackberry express. Email a presentation to convert it to html and open the html for invoke.sys.broser......

    Posted via CB10
    09-08-17 03:30 AM

Similar Threads

  1. Any more info on N-Series?
    By Ekilla in forum News & Rumors
    Replies: 1
    Last Post: 09-10-12, 12:51 AM
  2. Any more info on the Playbook 3G/4G
    By llllBULLSEYE in forum BlackBerry PlayBook
    Replies: 4
    Last Post: 03-02-12, 11:10 PM
  3. Any more info on Blackberry 9790 "Bellagio"
    By bttitan in forum BlackBerry Bold 9790
    Replies: 1
    Last Post: 09-03-11, 03:17 AM
  4. Any more info on Blackberry 9790 "Bellagio"
    By bttitan in forum Rumored Devices
    Replies: 1
    Last Post: 09-03-11, 03:17 AM
  5. is there any more info about the driftwood?
    By metsman23 in forum Rumored Devices
    Replies: 0
    Last Post: 08-01-09, 08:37 PM
LINK TO POST COPIED TO CLIPBOARD