Page 1 of 2
start using?
Posted: Sat Jan 21, 2012 5:06 am
by Kevin
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
Re: start using?
Posted: Sat Jan 21, 2012 12:35 pm
by Mark
Hello,
Yes it should be there and the correct syntax is "start using stack <stackname>" instead of "start using <stackname>".
Kind regards,
Mark
Re: start using?
Posted: Sat Jan 21, 2012 6:29 pm
by Kevin
@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.
Re: start using?
Posted: Sat Jan 21, 2012 7:32 pm
by jacque
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.
Re: start using?
Posted: Tue Dec 17, 2013 9:11 am
by Simon
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
Re: start using?
Posted: Tue Dec 17, 2013 9:33 am
by Mark
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
Re: start using?
Posted: Tue Dec 17, 2013 9:46 am
by Simon
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
Re: start using?
Posted: Tue Dec 17, 2013 10:33 am
by Simon
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
Re: start using?
Posted: Tue Dec 17, 2013 10:58 am
by Mark
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
Re: start using?
Posted: Tue Dec 17, 2013 11:25 am
by Simon
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
Re: start using?
Posted: Tue Dec 17, 2013 8:35 pm
by jacque
Could this be due to a password-protected stack that the community version can't open?
Re: start using?
Posted: Tue Dec 17, 2013 10:37 pm
by Simon
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
Re: start using?
Posted: Tue Dec 17, 2013 10:51 pm
by Klaus
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?
Best
Klaus
Re: start using?
Posted: Wed Dec 18, 2013 12:28 am
by Simon
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
Re: start using?
Posted: Wed Dec 18, 2013 3:26 am
by Klaus
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
Best
Klaus