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, kevinmiller, robinmiller

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

Re: Open a LC document using a standalone

Post by Klaus » Thu Aug 27, 2020 4:32 pm

Hi Max,

you have a standalone and a separate stack.
You want to open and later also SAVE that separate stack.
To do so, we need to copy that stack to a folder where we have write permission, which is specialfolderpath("documents")
Copying in LC goes via: put url("binfile:...") into url("binfile:"...)
URL means we target a FILE, either on the internet or on the users hard disk.
Please read up all unknown terms in the dictionary!

BINFILE means we are dealing with a BINARY file, in contrary to (text) FILE, which will only work for pure TEXT files like TXT, XML, HTML etc. But stacks are BINARY so we need to use BINFILE or we end with a corrupted stack!

And we do this in a IF THEN clause because we do not want to overwrite our copied stack with every launch of our app.

The script I posted has to go into the STANDALONE stack, that needs to do the copying if neccessary BEFORE opening the copied stack and THEN the standalone opens that stack in -> specialfolderpath("documents")
The script works definitively if used at the right time and location! :-)

Please post your script(s) if in doubt.


Best

Klaus

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

Re: Open a LC document using a standalone

Post by maxs » Thu Aug 27, 2020 9:09 pm

Hi Klaus,

Thank you again for taking the time, not only to respond again but to define the Livecode unfriendly code definitions.

I have implemented everything you, Jackie, and others have suggested, tested everything at least 5 times, and I am not a step closer to being able to open my stack in an editable format.

Please let me know if there is any other possible steps I can take. I realize you have done a lot already, and I do not expect any more assistance.

My best, Max


I have shared all my code with you already. Here it is below:
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

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

Re: Open a LC document using a standalone

Post by Klaus » Thu Aug 27, 2020 9:20 pm

Hi Max,
maxs wrote:
Thu Aug 27, 2020 9:09 pm
. I realize you have done a lot already, and I do not expect any more assistance.
ha, you won't get rid of me that easily! :-D

This last line

Code: Select all

...
GO STACK tDestPath
...
does open the desired stack, right?
And it looks correct and everything is in place?

It has been asked here before, but you did not answer this yet, please show us the script that saves that namely stack!
You DO save that stack, don't you? 8)


Best

Klaus

Post Reply

Return to “Talking LiveCode”