Doesn't matter, also works with Livecode files.
Open a LC document using a standalone
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- VIP Livecode Opensource Backer
- Posts: 7238
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Open a LC document using a standalone
Most likely the file paths are incorrect, as Richard noted. It sounds like you have the setup correct:maxs wrote: ↑Wed May 09, 2018 1:00 amHi 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
StackA will be the standalone, with all standalone options filled out in Standalone Settings.
StackB is the data stack to be included with the build. It is listed in the Copy Files pane of Standalone Settings.
When LC builds the standalone, anything in Copy Files is put into a folder named "resources" which the standalone builder creates. The correct path to that folder and its file is: specialFolderPath("resources") & "/stackB.livecode"
Since files can't be saved inside the application folder, you need to copy StackB to a writeable location. That can be the desktop ("specialFolderPath("desktop")) or documents, or some other places. Let's assume you want it to go to Documents: specialFolderPath("documents")
So the copy mechanism is:
Code: Select all
put specialFolderPath("resources") & "/stackB.livecode" into tSourcePath
put specialFolderPath("documents") & "/stackB.livecode" into tDestPath
put ("binfile:" & tSourcePath) into ("binfile:" & tDestPath)
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Open a LC document using a standalone
Hi Jacque
I'm so impressed with myself that I came to the same conclusion today. It may be an incorrect path or name. Now I will try testing it out. Thanks, Max
Max
I'm so impressed with myself that I came to the same conclusion today. It may be an incorrect path or name. Now I will try testing it out. Thanks, Max
Max
Re: Open a LC document using a standalone
Breakthrough:
I did it.
Here are the 4 major errors I made:
The resource file name needed to be the same as the document file name. (I had the Standalone file as the app resource name. I never understood that they are basically the same file. )
There were uppercase letters.
I needed to delete ".livecode" from the file name of the embedded resource stack.
I could not find any documentation on this in the Livecode library.
Thanks to Jacque and Klaus for following through with me. This was really a difficult process for me to understand.
I did it.
Here are the 4 major errors I made:
The resource file name needed to be the same as the document file name. (I had the Standalone file as the app resource name. I never understood that they are basically the same file. )
There were uppercase letters.
I needed to delete ".livecode" from the file name of the embedded resource stack.
I could not find any documentation on this in the Livecode library.
Thanks to Jacque and Klaus for following through with me. This was really a difficult process for me to understand.
Re: Open a LC document using a standalone
postscript
THe forums have become the basic lifesaver for my most urgent problems I have making app, thanks to a few really kind people.
Nevertheless, it is insanely difficult to get clarifications of things when communication is not back and forth as easily as it is with talking or chatting.
I would gladly pay for the instant gratification of instant communication, if that ever became available. But I can understand why people giving help prefer it this way.
THe forums have become the basic lifesaver for my most urgent problems I have making app, thanks to a few really kind people.
Nevertheless, it is insanely difficult to get clarifications of things when communication is not back and forth as easily as it is with talking or chatting.
I would gladly pay for the instant gratification of instant communication, if that ever became available. But I can understand why people giving help prefer it this way.
-
- VIP Livecode Opensource Backer
- Posts: 7238
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Open a LC document using a standalone
Bravo! So glad you got it working. When you're first starting there's a lot to learn, but soon things will feel commonplace. The "eureka" moment at the end of a long struggle can be a giddy reward though.
One advantage of written explanations is that others who follow can find answers. But I do understand that it's often easier to talk through issues where clarifications can be more immediate. Many of the old-timers here would probably be available for consulting work if it comes to that.
One advantage of written explanations is that others who follow can find answers. But I do understand that it's often easier to talk through issues where clarifications can be more immediate. Many of the old-timers here would probably be available for consulting work if it comes to that.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
-
- VIP Livecode Opensource Backer
- Posts: 7238
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Open a LC document using a standalone
You know, looking at my example script I see that I omitted the URL keyword. Did it work as written? It should have been:
put url ("binfile:" & tSourcePath) into url ("binfile:" & tDestPath)
We all have blackouts occasionally I guess. You can't trust anyone these days.
put url ("binfile:" & tSourcePath) into url ("binfile:" & tDestPath)
We all have blackouts occasionally I guess. You can't trust anyone these days.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Open a LC document using a standalone
It looks like I had the exact same problem 2 years ago. How do I open an editable LC document using a standalone on a Mac?
Im still lost. Copying it into the Standalone renders in uneditable.
Any ideas? Max
Im still lost. Copying it into the Standalone renders in uneditable.
Any ideas? Max
Re: Open a LC document using a standalone
Everything here in this thread is still valid, so what is your problem exactly?
Basically you do:
Basically you do:
Code: Select all
...
put specialFolderPath("resources") & "/stackB.livecode" into tSourcePath
put specialFolderPath("documents") & "/stackB.livecode" into tDestPath
## Check fi stack is already present:
if there is not a file tDestPath then
put URL("binfile:" & tSourcePath) into URL("binfile:" & tDestPath)
end if
## This is the important line, we have to open THIS stack of course:
GO STACK tDestPath
...
Re: Open a LC document using a standalone
Hi Klaus,
I used "copy files" to add the stack to the standalone, and I included the code you recommended to the openstack handler, changing the name to "Open Workshop". (Stand Alone stack name)
It opened a copy of this stack that has no icon images, and when I reopen the stack, it does not save any text I typed into a field. (If I copy the stack to Stack: Stack files in the application", then the stack opens with the icons displayed. )
--put specialFolderPath("resources") & "/Open Workshop.livecode" into tSourcePath
--put specialFolderPath("documents") & "/Open Workshop.livecode" into tDestPath
I also tried it with
put specialFolderPath("documents") & "/Spolin Workshop.livecode" into tDestPath. with the same results.
Any ideas?
Also, this issue is extremely important to me. I'm sorry to burden you with this. Let me know if I should look elsewhere for help. My best Max
I used "copy files" to add the stack to the standalone, and I included the code you recommended to the openstack handler, changing the name to "Open Workshop". (Stand Alone stack name)
It opened a copy of this stack that has no icon images, and when I reopen the stack, it does not save any text I typed into a field. (If I copy the stack to Stack: Stack files in the application", then the stack opens with the icons displayed. )
--put specialFolderPath("resources") & "/Open Workshop.livecode" into tSourcePath
--put specialFolderPath("documents") & "/Open Workshop.livecode" into tDestPath
I also tried it with
put specialFolderPath("documents") & "/Spolin Workshop.livecode" into tDestPath. with the same results.
Any ideas?
Also, this issue is extremely important to me. I'm sorry to burden you with this. Let me know if I should look elsewhere for help. My best Max
-
- VIP Livecode Opensource Backer
- Posts: 7238
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Open a LC document using a standalone
You can't save changes to the standalone, only to other stacks the standalone opens. So the name of the stack you copy to the documents folder must be the name of the stack you included in Copy Files.
Basically, any standalone, including all the files saved with it, can't be altered. But copying a mainstack out of the standalone bundle to a writeable location like Documents will allow it to be saved.
Basically, any standalone, including all the files saved with it, can't be altered. But copying a mainstack out of the standalone bundle to a writeable location like Documents will allow it to be saved.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Open a LC document using a standalone
HI Jacque,
Thanks so much for helping out here.
Yes, I have a stack outside the standalone that the standalone can open. Yes, I copied the stack to pre-standalone version using copy files.
The standalone will open the stack, but not allow me to save any changes to that stack. So I am sure I am doing something wrong.
Max
Thanks so much for helping out here.
Yes, I have a stack outside the standalone that the standalone can open. Yes, I copied the stack to pre-standalone version using copy files.
The standalone will open the stack, but not allow me to save any changes to that stack. So I am sure I am doing something wrong.
Max
-
- VIP Livecode Opensource Backer
- Posts: 7238
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Open a LC document using a standalone
How are you saving the stack? It might be useful to see the script that does that.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Open a LC document using a standalone
Just to be clear, when you set the standalone builder settings to include the separate stack with the "copy files" tab, that separate stack gets included as part of the standalone bundle. You can open the file from the relative location in specialFolderPath("resources"). Very often, you will find the typical install location of a standalone is not writable.
So having bundled your stack with the standalone for deployment, you would need to ensure that it is copied from "resources" to a writable location, such as "documents" or other application data/preferences folder. You can check on first run whether the file exists in that location, and only copy if it doesn't, so that you don't overwrite previously saved data.
So forgive me if I am suggesting what you have already done, but I don't see any explicit indication above that you have made this copy of the stack to a writable location, and it could be the (relatively) simple answer. Or not
So having bundled your stack with the standalone for deployment, you would need to ensure that it is copied from "resources" to a writable location, such as "documents" or other application data/preferences folder. You can check on first run whether the file exists in that location, and only copy if it doesn't, so that you don't overwrite previously saved data.
So forgive me if I am suggesting what you have already done, but I don't see any explicit indication above that you have made this copy of the stack to a writable location, and it could be the (relatively) simple answer. Or not
Re: Open a LC document using a standalone
Hi SparkOut,
Ok I made sure the livecode document was in the "documents" folder, and that I included it in the standalone using "Copy Files" .
So I made the standalone and now the standalone will open but the stack with all the icons missing and new text in text files will not save when the stack is reopened. It may have to do with the possibly incorrect code below. I have no idea what this code means. (binfile, URL,). Max
on Openstack
--open stack "Spolin Workshop.livecode"
put specialFolderPath("resources") & "/Spolin Workshop.livecode" into tSourcePath
put specialFolderPath("documents") & "/Spolin Workshop.livecode" into tDestPath
## Check if stack is already present:
if there is not a file tDestPath then
put URL("binfile:" & tSourcePath) into URL("binfile:" & tDestPath)
end if
## This is the important line, we have to open THIS stack of course:
GO STACK tDestPath
end Openstack
Ok I made sure the livecode document was in the "documents" folder, and that I included it in the standalone using "Copy Files" .
So I made the standalone and now the standalone will open but the stack with all the icons missing and new text in text files will not save when the stack is reopened. It may have to do with the possibly incorrect code below. I have no idea what this code means. (binfile, URL,). Max
on Openstack
--open stack "Spolin Workshop.livecode"
put specialFolderPath("resources") & "/Spolin Workshop.livecode" into tSourcePath
put specialFolderPath("documents") & "/Spolin Workshop.livecode" into tDestPath
## Check if stack is already present:
if there is not a file tDestPath then
put URL("binfile:" & tSourcePath) into URL("binfile:" & tDestPath)
end if
## This is the important line, we have to open THIS stack of course:
GO STACK tDestPath
end Openstack