Page 1 of 1

Put variable into Android field

Posted: Fri Dec 13, 2019 12:34 pm
by shawnblc
I'm trying to do somethin like the following, but I keep getting a script error. How would I put something into the Android Field and make it not editable?

Code: Select all

put char 44 to 77 of line 3 of URL "https://domain.com/string.php" into tandroidFld1
answer tandroidFld1
put tandroidFld1 into widget "androidFld1"
Here's the error.

Code: Select all

Type	Chunk: destination is not a container
Object	Navigation Bar
Line	put tandroidFld1 into widget "androidFld1"
Hint	hiliteChanged

Re: Put variable into Android field

Posted: Fri Dec 13, 2019 12:44 pm
by Klaus
Hi Shawn,

well, an URL is no container in the LC sense like a variable or field.
You need to load the URL first, then do the rest:

Code: Select all

...
## This should do the trick:
put URL "https://domain.com/string.php" into tURLContent
put char 44 to 77 of line 3 of tURLContent into tandroidFld1
answer tandroidFld1
put tandroidFld1 into widget "androidFld1"
...
Best

Klaus

Re: Put variable into Android field

Posted: Fri Dec 13, 2019 2:12 pm
by shawnblc
Same error. Still plugging away.

Re: Put variable into Android field

Posted: Fri Dec 13, 2019 2:32 pm
by Klaus
Did you check "Internet" etc. in the "Standalone Application Settings" for your Android App?

And what does THE RESULT tell you:

Code: Select all

...
put URL "https://domain.com/string.php" into tURLContent
if the result <> EMPTY then
  answer "Error:" & CR & the result
  exit to top
end if
put char 44 to 77 of line 3 of tURLContent into tandroidFld1
answer tandroidFld1
## put tandroidFld1 into widget "androidFld1"
## See below for correct syntax
...
AH! Completely overlooked this one, that is not the correct syntax for the widget!

Code: Select all

...
answer tandroidFld1
## put tandroidFld1 into widget "androidFld1"
set the text of widget "androidFld1" to tandroidFld1
...
I repeat: The dictionary is your friend! 8)