Page 3 of 4

Re: Open a LC document using a standalone

Posted: Tue May 01, 2018 2:16 pm
by Klaus
Hi Max,

from your last mail I think we have a VERY BIG misunderstanding here!

1. You can NOT make a copy of the stack that has been turned into a standalone!
2. We are talking about separate files.
3. We are talking about the so called "splash" screen technique.
4. Yes -> put url("binfile:...) into url ("binfile:...) will make a copy of a file.

Example:
You have a stack MYSTACK that you want to make a standalone from but also want to make that stack editable.
Then you do NOT create a standalone from that stack but rather create an extra stack e.g. "splash", which will only be turned into the standalone and open stack MYSTACK.

Now create a standalone from stack "splash" and add the stack MYSTACK to the standalone via the "Copy files" tab as explained earlier. THEN you can use my script to copy stack "MYSTACK to the users docs folder if neccessary, because we have your stack as a separate file in the app bundle and can be copied to the users doc folder.

Capisce? :D


Best

Klaus

Re: Open a LC document using a standalone

Posted: Tue May 01, 2018 6:38 pm
by FourthWorld
Brian's post is well worth a second read:
viewtopic.php?f=9&t=30817&start=15#p166830

Re: Open a LC document using a standalone

Posted: Wed May 02, 2018 1:58 am
by maxs
Klaus,

You were very clear the first time. I understood exactly what you were saying. I did exactly as you suggested.

The error seems to be with
put url("binfile:...) into url ("binfile:...)

It makes a file with the correct name in the correct place, but is completely empty.

I am not sure why this is not copying correctly.

Because of you help, I am now actually optimisic about getting this to work. I'll try again with version 9 of livecode.

Max

Re: Open a LC document using a standalone

Posted: Wed May 02, 2018 4:16 am
by FourthWorld
maxs wrote:
Wed May 02, 2018 1:58 am
I am not sure why this is not copying correctly.
That's where the sysError function comes in.

Re: Open a LC document using a standalone

Posted: Wed May 02, 2018 5:28 am
by maxs
Hi Richard,

I used the sysError function . It returned only the number "2".

Bathroom humor?

Here is the file attached

Re: Open a LC document using a standalone

Posted: Wed May 02, 2018 5:59 am
by FourthWorld
maxs wrote:
Wed May 02, 2018 5:28 am
I used the sysError function . It returned only the number "2".
You can find error codes for each OS online. For most, Error 2 is an invalid path to a file.

Re: Open a LC document using a standalone

Posted: Wed May 02, 2018 10:40 am
by Klaus
Hi Max,
maxs wrote:
Wed May 02, 2018 1:58 am
You were very clear the first time. I understood exactly what you were saying. I did exactly as you suggested.
not completely! :D

I did not tell you to create a stack named "testb.livecode" and add it to your standalone!
You don't need it here at all!

I meant that you have to copy the stack inside of the app package "testa.livecode" and copy it to the users douments folder to a file named the same "testa.livecode".

But that is not the problem here! The pathnames are definitively OK, I'm out of ideas in the moment...


Best

Klaus

Re: Open a LC document using a standalone

Posted: Thu May 03, 2018 2:07 am
by maxs
Hi Klaus,

Please forgive me. I must be dense.

I have read the sentence below many many times, and I just do not understand what this means. Perhaps that is why things are not working,
--
"I meant that you have to copy the stack inside of the app package "testa.livecode" and copy it to the users douments folder to a file named the same "testa.livecode"."

Stack Testa is and empty splash screen app that opens stack testb, which has all my data. Stack testb will open when I click on stack test A. I just cant get the "bin" code to make a copy of the stack.

I completely understand if you want to give up helping me. Max

Re: Open a LC document using a standalone

Posted: Thu May 03, 2018 11:54 am
by Klaus
Hi Max,

I never give up! :-)
maxs wrote:
Thu May 03, 2018 2:07 am
...
Stack Testa is and empty splash screen app that opens stack testb, which has all my data. Stack testb will open when I click on stack test A. I just cant get the "bin" code to make a copy of the stack.
OK, I think I can see the little misunderstanding now:
You create a standalone from stack "testa.livecode".
But then that is not a STACK anymore and so there is NO file "testa.livecode" inside of the "resources" folder! That's why we end with a 0 KB file.

You want to edit, modify and save stack "testB.livecode", so you need to copy THAT stack to the users DOCS folder and open it:

Code: Select all

on openstack
   ## Create path to RESOURCES folder!!!!! and target stack in the users docs folder
   put specialfolderpath("resources") & "/testb.livecode" into tSourceStack 
   put specialfolderpath("documents") & "/testb.livecode" into tTargetStack

   ## check if stack already exists:
   if there is not a file tTargetStack then
      put url("binfile:" & tSourceStack) into url("binfile:" & tTargetStack)
   end if

   ## Now open that stack that we can modify and SAVE!
   go stack tTargetStack
end openstack
Next time please check "the result" as suggested, it may have given you something like "No such file".


Best

Klaus

Re: Open a LC document using a standalone

Posted: Tue May 08, 2018 5:03 am
by maxs
OK Klaus


The main Stack is in my documents folder. I am ready to add the code you shared, and build a standalone.

Here is here I am stuck : What is the "editable" stack That I add via the "Copy files" tab? I understand you to say I need only one stack. So what am I adding? DO I need 1 stack or two? Am I making a second copy of my stack and copying it into the the "Copy files" tab?

Dazed and confused, Max

1. Add that "editable" stack via the "Copy files" tab in the "standalone builder settings"!
2. When your app starts, copy that stack over to the users documents folder,
this is where we definitivley have WRITE (save a stack) permission!
(I assume this is done with the code you sent me.)
3. use the copied folder from now on.

Re: Open a LC document using a standalone

Posted: Tue May 08, 2018 1:18 pm
by Klaus
Hi Max,

we have two stacks:
1. "splash.livecode"
Which has NO functionality except to open the stack you want to work on and save.
That standalone is made from THIS stack!

2. "you actual stack.livecode"
This one is the stack you wanted to create a standalone from but can't because you want to edit and SAVE this stack at some point.

OK, now you decide! 8)


Best

Klaus

Re: Open a LC document using a standalone

Posted: Wed May 09, 2018 1:00 am
by maxs
Hi Klaus,

Yes, This is how I originally had it. The stack.livecode ("Testb") was included in the Splash.livecode ("Testa") via the "Copy files" tab , before making the standalone

So the Splash.livecode standalone would create a stack.livecode in the documents folder that was completely empty.

The url("binfile:...) into url ("binfile:...) only made an empty copy of a file.

SO why doesn't the work? Why is the file empty? Did you see may examples files. It seems I followed your directions completely but the file is still empty.
Densely yours, Max

Re: Open a LC document using a standalone

Posted: Wed May 09, 2018 8:42 am
by jmburnod
Hi Max,
("Testb") was included in the Splash.livecode ("Testa") via the "Copy files" tab , before making the standalone
"Copy files" tab is only for non stack files
Best regards
Jean-Marc

Re: Open a LC document using a standalone

Posted: Wed May 09, 2018 10:38 am
by Klaus
You can add ANY type of file including LC files via the "Copy files" tab!

Re: Open a LC document using a standalone

Posted: Wed May 09, 2018 1:07 pm
by jmburnod
Hi Klaus,
I'm a little confused about copy files tab where I can read:
non-stack files in the application
Kind regards
Jean-Marc