start using?

The place to discuss anything and everything about running your LiveCode on Android

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Kevin
Posts: 74
Joined: Fri Oct 02, 2009 3:47 pm

start using?

Post by Kevin » Sat Jan 21, 2012 5:06 am

I have added a stack that I utilize as library to the Standalone Application Settings->Stacks dialog and verified the file is NOT in the APK should it be there? Tried load it anyway as shown below and get my error dialog. Suggestions?

try
start using "libXyz"
catch _e
answer error "Unable to load 'libXyz'" with "OK" titled "Error loading library"
end try

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: start using?

Post by Mark » Sat Jan 21, 2012 12:35 pm

Hello,

Yes it should be there and the correct syntax is "start using stack <stackname>" instead of "start using <stackname>".

Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Kevin
Posts: 74
Joined: Fri Oct 02, 2009 3:47 pm

Re: start using?

Post by Kevin » Sat Jan 21, 2012 6:29 pm

@Mark The syntax ...

Code: Select all

try
    start using "libBasics"
catch _e
    answer error "Unable to load 'libBasics'" with "OK" titled "Error loading libraries!"
end try


functions on Linux, Windows and OSX as I have utilized it on all in production code. In the event that Android is different I attempted the syntax you provided and received the same error.

Code: Select all

   try
      start using stack "libBasics"
   catch _e
      answer error "Unable to load 'libBasics'" with "OK" titled "Error loading libraries!"
   end try
Again I am unable to locate the file in the APK.

FYI: I am using 5.0.2 (fully licensed for Windows, Linux, Mac OSX and Android) it is what was formerly a Enterprise Version (Windows,Linux,OSX). The majority of my applications are Linux driven by Windows client program also written in RR. I am attempting to create a Android client as we are expanding our support.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7214
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: start using?

Post by jacque » Sat Jan 21, 2012 7:32 pm

I'd continue to use the "stack" syntax, it will work on any platform and is the correct form. If the file really isn't included in the build at all, the standalone builder may not be able to find it. Try putting the library stack into the same folder as your main stack and reselect it in the SB before building again.

If that works but the library still doesn't load, then try providing a full path to the stack, which will be relative to the engine:

start using stack specialFolderPath("engine") & "/libBasics.lc"

or whatever its name and path is on disk, including the extension.

Personally I'd just add the library as a substack of the mainstack, and it will be found for sure without any path or inclusion issues.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: start using?

Post by Simon » Tue Dec 17, 2013 9:11 am

Hello all,
OK now I'm having trouble with this on Android.

Code: Select all

 put url ("binfile:" & specialFolderPath("engine") & "/PHMData.livecode") into \
   url ("binfile:" & specialFolderPath("documents") & "/PHMData.livecode")
set the defaultFolder to specialFolderPath("documents")
answer the files --This does show that PHMData.livecode is in the documents folder
start using stack "PHMData.livecode"-- Have also tried (specialFolderPath("documents") & "/PHMData.livecode")
I have that in the openStack script and the file is in the Copy Files panel.
PHMData.livecode only contains 3 custom properties that I intend to read/write/save.
Everything works great on the desktop but once in Android I'm getting errors (91 is the first).

All of this is tested with an empty stack with just the above.

Thanks for any help,
Simon
Edit Win 7 LC 6.5.1 rc 1 and 6.5
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: start using?

Post by Mark » Tue Dec 17, 2013 9:33 am

Hi Simon,

What is the problem exactly? Doesn't your stack appear in the stacksInUse? Perhaps you are unable to save the stack? You might want to check the result after the start using command.

Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: start using?

Post by Simon » Tue Dec 17, 2013 9:46 am

Hi Mark,
Thanks for replying.
I just put an "answer the result" after the "start using" and it never gets that far (no answer dialog).

Oh yes I do have an "on errorDialog" giving me
91,11,13
568,11,1
253,2,1
241,2,1
I did look them up 91 gives "Chunk: can't find stack"
Perhaps you are unable to save the stack?
Not sure what you mean by that? The stack is there.

Any other ideas?
I'm stumped.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: start using?

Post by Simon » Tue Dec 17, 2013 10:33 am

Ah a hint!

Code: Select all

  try
         start using stack (specialFolderPath("documents") & "/PHMData.livecode")
      catch _e
         answer the result
      end try
"stack was produced by a newer version"

But both stacks are made and saved with liveCode 6.5

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: start using?

Post by Mark » Tue Dec 17, 2013 10:58 am

Hi Simon,

Maybe it is a LiveCode bug? For now, you could try to save your stack in an older format. It is also possible that the stack is corrupted when you save a copy of it in the documents folder. It might be insightful to check the actual path to the stack:

Code: Select all

put (specialFolderPath("documents") & "/PHMData.livecode") into myPath
if there is a file myPath then
  if there is a stack myPath then
    start using stack myPath
    put the result into rslt
    if rslt is not empty then
      answer error rslt
    end if
  else
    answer error "Can't find stack" && myPath
  end if
else
  answer error "Can't find file" && myPath
end if
Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: start using?

Post by Simon » Tue Dec 17, 2013 11:25 am

Thanks again Mark,
I did try saving PMHData.livecode in a legacy format, still no joy. :(

With your addition it says the file is there but the stack is not... Which means??

I've attached the 2 stacks for testing.

Simon
Attachments
startUsing.zip
LC 6.5
(2.21 KiB) Downloaded 200 times
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7214
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: start using?

Post by jacque » Tue Dec 17, 2013 8:35 pm

Could this be due to a password-protected stack that the community version can't open?
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: start using?

Post by Simon » Tue Dec 17, 2013 10:37 pm

Hi Jacque,
Thanks for looking into this.
Both stacks were made with the commercial version. No passwords.

Can't find a bug report on it.

Simon
Edit; filed report Bug 11622
Last edited by Simon on Sat Dec 21, 2013 5:21 am, edited 1 time in total.
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: start using?

Post by Klaus » Tue Dec 17, 2013 10:51 pm

Hi Simon,

you said there are no script in that stack, just some custom prop you want to save data in?
Then you don't need to "start using" it! (Maybe LC will choke on a missing script to "use" here?)

Just set and get these props and save the stack when closing the app:
...
put specialFolderPath("documents") & "/PHMData.livecode" into the_StoreStack
set the cWhateverprop of stack the_StoreStack to "Some data..."
...
put specialFolderPath("documents") & "/PHMData.livecode" into the_StoreStack
put the cWhateverprop of stack the_StoreStack into fld "data from CP"
...
Save and close when doen:
...
put specialFolderPath("documents") & "/PHMData.livecode" into the_StoreStack
save stack the_StoreStack
close stack the_StoreStack
## quit...
...
When you address a stack(file) on disk this way, LC will invisibly open the MAINSTACK of that
stackfile as the target for all commands/set/getprop without triggering any mesages like "openstack" etc.

Maybe that works for you or did I misunderstand you completely? 8)


Best

Klaus

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: start using?

Post by Simon » Wed Dec 18, 2013 12:28 am

Hi Klaus,
did I misunderstand you completely?
No, you got it spot on.
I did try your method of "not using ... using" but while the file is found the stack is not.

Yes, it's just a data stack to hold some arrays, works fine on the desktop but not on a device or sim. I tried adding non-interrupting code to the openStack and openCard scripts to try and make it look more like a normal stack but that didn't help.

While I'm not giving up; is there a way to arrrayEncode several arrays to 1 file? (and decode them for output).

Thanks,
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: start using?

Post by Klaus » Wed Dec 18, 2013 3:26 am

Hi Simon,

very strange, maybe a Android issue of some sort?
Simon wrote:While I'm not giving up; is there a way to arrrayEncode several arrays to 1 file? (and decode them for output).
You could store them in one line each in a text file:
...
urlencode(base64encode(arrayencode(Your_Array1)))
...
And vice versa for decoding :D


Best

Klaus

Post Reply

Return to “Android Deployment”