Open a LC document using a standalone

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: Klaus, FourthWorld, heatherlaine, robinmiller, kevinmiller

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

Re: Open a LC document using a standalone

Post by Klaus » Tue May 01, 2018 2:16 pm

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

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6716
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Open a LC document using a standalone

Post by FourthWorld » Tue May 01, 2018 6:38 pm

Brian's post is well worth a second read:
viewtopic.php?f=9&t=30817&start=15#p166830
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

maxs
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 402
Joined: Sat Jun 24, 2006 12:02 am
Contact:

Re: Open a LC document using a standalone

Post by maxs » Wed May 02, 2018 1:58 am

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

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6716
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Open a LC document using a standalone

Post by FourthWorld » Wed May 02, 2018 4:16 am

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.
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

maxs
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 402
Joined: Sat Jun 24, 2006 12:02 am
Contact:

Re: Open a LC document using a standalone

Post by maxs » Wed May 02, 2018 5:28 am

Hi Richard,

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

Bathroom humor?

Here is the file attached
Attachments
testb.livecode.zip
(949 Bytes) Downloaded 32 times
testa.livecode.zip
(1.92 KiB) Downloaded 31 times

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6716
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Open a LC document using a standalone

Post by FourthWorld » Wed May 02, 2018 5:59 am

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.
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

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

Re: Open a LC document using a standalone

Post by Klaus » Wed May 02, 2018 10:40 am

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

maxs
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 402
Joined: Sat Jun 24, 2006 12:02 am
Contact:

Re: Open a LC document using a standalone

Post by maxs » Thu May 03, 2018 2:07 am

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

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

Re: Open a LC document using a standalone

Post by Klaus » Thu May 03, 2018 11:54 am

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

maxs
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 402
Joined: Sat Jun 24, 2006 12:02 am
Contact:

Re: Open a LC document using a standalone

Post by maxs » Tue May 08, 2018 5:03 am

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.

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

Re: Open a LC document using a standalone

Post by Klaus » Tue May 08, 2018 1:18 pm

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

maxs
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 402
Joined: Sat Jun 24, 2006 12:02 am
Contact:

Re: Open a LC document using a standalone

Post by maxs » Wed May 09, 2018 1:00 am

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

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2350
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: Open a LC document using a standalone

Post by jmburnod » Wed May 09, 2018 8:42 am

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

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

Re: Open a LC document using a standalone

Post by Klaus » Wed May 09, 2018 10:38 am

You can add ANY type of file including LC files via the "Copy files" tab!

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2350
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: Open a LC document using a standalone

Post by jmburnod » Wed May 09, 2018 1:07 pm

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

Post Reply

Return to “Talking LiveCode”