Page 1 of 2

Read from process !!

Posted: Mon Dec 26, 2011 4:51 am
by carloz
hi all,

Have been trying to open a process, and read a line from it.. the code/function worked fine on my windows laptop , but the same dosent work on android

heres what i am doing.


on mouseUp
put specialFolderPath("engine") into tSndPath
put tSndPath into myDirPath
split myDirPath using "/"
put the last line of the keys of myDirPath into myLastElement
delete variable myDirPath[myLastElement]
combine myDirPath using "/"
put myDirPath & "/other_app_here.apk" into tSndPath
launch tSndPath
open process tSndPath for read
read from process tSndPath until end
put tSndPath into field "Field"
end mouseUp


in the above code, the path to other_app is correct, but neither the "launch" nor "open process" execute other_app.apk.
can someone plz help to figure out whats wrong ?

regards
carloz

Re: Read from process !!

Posted: Mon Dec 26, 2011 4:47 pm
by sturgis
While I suspect what you're trying to do is not allowed, I wanted to point out a couple things.

First, from what I understand there is no absolute guarantee that key elements will always come out the same order they went in. Something to watch for. Also, if all you want to do is remove the last item after the slash, its much easier to

put whateverMyPathIs into tPath
set the itemdelimiter to "/"
delete item -1 of tPath

Then to tack on the replacement item you can
put "/yourapptorun" after tPath

Or instead of deleting item -1 of tpath you can
put "yourapptorun" into item -1 of tPath -- will just replace the whatever is currently in that item position. Still must set the itemdelimiter.

Still pretty sure you don't have rights to start another app that way but will mess around with it some here to see if there is a way. Hopefully someone else will have a definitive answer.

Re: Read from process !!

Posted: Tue Dec 27, 2011 2:53 am
by carloz
hi ,

thnx for replying. what i am trying to do is to execute a barcode scanner app on my phone from livecode and get the result.
if you say this might not be allowed, how else can we do it?

regards
carloz

Re: Read from process !!

Posted: Tue Dec 27, 2011 3:10 am
by sturgis
Hmm. Not sure. One option might be to see if there is some public domain android code for scanning barcodes that could be converted to a livecode external. (don't know anything about making externals for android though so i'm yet again clueless on this front) If you CAN figure out how to make an external and library that will do this I'm betting you could sell it pretty well at the runrev store.

The other thing i'm wondering is how the barcode scanner functions. A while back I dealt with some scanners that were basically glorified keyboards. Connect em, go to the field or whatever where you want to capture a barcode, hit the button and viola' standard keycodes, so the barcode number appears in the field. But this was not on a phone, not android, was on a winpc and the scanner hooked up with a ps2 pass through dongle. (did I mention this was a while back? I should have said QUITE a while back)

While I doubt I can help beyond guesswork, what scanner are you using? Bluetooth? Physical connection to your phone? Do you know if its doing serial communication through the bluetooth and/or physical connection? If its serial you might be able to write some handlers to tackle this (IF serial comm is supported by livecode for android so far...) You've got me curious now though so please share what you discover!

Re: Read from process !!

Posted: Tue Dec 27, 2011 6:01 am
by carloz
hi,

am using the camera phone for the scanning. have a look at the zxing scanner on android market. also look at lowprice on android market. what lowprice does is it launches zxing scanner and uses the value returned by it to search for books.

am trying to achive the same.

regards
carloz

Re: Read from process !!

Posted: Tue Dec 27, 2011 3:48 pm
by sturgis
Ok. Am going to read up. No guarantee, this is outside my comfort zone but if I figure anything out i'll post here.

Re: Read from process !!

Posted: Tue Dec 27, 2011 3:57 pm
by carloz
thnx mate... am doing the same. il post here too if i find a solution..
hope one of the moderators see this and have a way out

regards
carloz

Re: Read from process !!

Posted: Tue Dec 27, 2011 4:05 pm
by Klaus
Hi guys,

"open/read from process" is currently NOT supported on Android (yet?)!
A quick look at the dictionary entry for "read from process" revealed this truth to me 8)


Best

Klaus

Re: Read from process !!

Posted: Tue Dec 27, 2011 4:23 pm
by sturgis
Hey Klaus,
do you know if there is a method to build android externals yet? So that this barcode library could maybe be used that way? Not that THAT is within my realm of ability either, but maybe someday.

Re: Read from process !!

Posted: Tue Dec 27, 2011 5:36 pm
by Klaus
Hi Sturgis,

sorry, neither do I develop for Android nor do I have the slightest idea about externals
(or other programming languages besides Livecode at all!) 8)


Best

Klaus

Re: Read from process !!

Posted: Tue Dec 27, 2011 5:43 pm
by carloz
hey klaus,

so using livecode , how does one open process and read from it? for any OS .. android,IOS etc


regards
carloz

Re: Read from process !!

Posted: Tue Dec 27, 2011 5:58 pm
by Klaus
Hi Carloz,

check the dictionary entry for "open process" and "read from process".
This is currently only supported on Mac/Win/Linux! No iOS or Androind support so far!


Best

Klaus

Re: Read from process !!

Posted: Tue Dec 27, 2011 6:03 pm
by carloz
oops... my bad.. :(

thnx klaus .. any way to do intents ?\


regards
carloz

Re: Read from process !!

Posted: Wed Dec 28, 2011 2:27 am
by sturgis
Ok thx much anyway. Livecode is pretty amazing and getting better all the time. I'm so tickled that I can actually get stuff done with LC that i'm not much interested in the other languages anymore either.
Klaus wrote:Hi Sturgis,

sorry, neither do I develop for Android nor do I have the slightest idea about externals
(or other programming languages besides Livecode at all!) 8)


Best

Klaus

Re: Read from process !!

Posted: Sat Mar 10, 2012 10:37 pm
by monte
Hi folks

As soon as there is an android eternal sdk I will release mergZXing for android.

Cheers

Monte