Repairing the amnesia of standalones

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

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7229
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Repairing the amnesia of standalones

Post by jacque » Sat Sep 23, 2017 6:32 pm

Copy Klaus' code exactly. In this line of your post the slash must go inside the quotes:

Code: Select all

--put specialfolderpath ("resources") & /"e-diary.livecode" into tTargetStack ( this line produced an eror like double binary)
It should be:

Code: Select all

put specialfolderpath ("resources") & "/e-diary.livecode" into tTargetStack
The "copy files" pane in the standalone builder is for any type of file, including stacks, that need to be separate from the app. The "stacks" pane is for stacks that need to be embedded in the standalone. Those will not be writable and changes will not be saved.

I have seen LC rename the mainstack "launcher" after a mobile build but I can't remember the details. You can ignore that, it's something LC needs and doesn't affect your working stacks.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

kresten
Posts: 152
Joined: Tue Sep 30, 2008 3:01 pm
Location: Copenhagen
Contact:

Re: Repairing the amnesia of standalones

Post by kresten » Sun Sep 24, 2017 1:04 am

Trying and trying, without result.
Present stacksript:
Can you late any error in this:
on openStack
put specialfolderpath("documents") & "/Phenomenalog 20.0.4" into tFolder
if there is not a folder tFolder then
create folder tFolder
end if
put tFolder & "/e-diary.livecode" into tSourceStack
put specialfolderpath ("resources") & "/e-diary.livecode" into tTargetStack
if there is not a file tSourceStack then
put url("binfile:" & tSourceStack) into url("binfile:" & tTargetStack)
end if
start using stack "Diary"
go stack tTargetStack
hide stack "Diary"
end openStack

I am really lost. I get the standalone, but it has no effect.

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

Re: Repairing the amnesia of standalones

Post by Klaus » Sun Sep 24, 2017 2:22 pm

As Jaque said, copy my code, it works!
In your script you are mixing tSourceStack and tTargetStack!

The stack in specialfolderpath("resources") needs to go -> specialfolderpath("documents")
Which is logical, right? 8)

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

Re: Repairing the amnesia of standalones

Post by Klaus » Sun Sep 24, 2017 2:25 pm

Code: Select all

on openStack
   put specialfolderpath("documents") & "/Phenomenalog 20.0.4" into tFolder
   if there is not a folder tFolder then
     create folder tFolder
   end if
   put tFolder & "/e-diary.livecode" into tTargetStack
   put specialfolderpath ("resources") & "/e-diary.livecode" into tSourceStack
   if there is not a file tTargetStack then
      put url("binfile:" & tSourceStack) into url("binfile:" & tTargetStack)
   end if
   start using stack "Diary"
   go stack tTargetStack
   hide stack "Diary"
end openstack

kresten
Posts: 152
Joined: Tue Sep 30, 2008 3:01 pm
Location: Copenhagen
Contact:

Re: Repairing the amnesia of standalones

Post by kresten » Mon Sep 25, 2017 2:51 pm

Sorry, I still can't make it work.
The standalones just opens the Diary.livecode file even if livecode is closed
I have copied your text directly into the file.
Could there be aspects of the standalone settings where I have failed. ?
There is a choice between search for required inclusions or select inclusions. I think I have tried both.
And then there is the warning in including folders snd files option, not to include stacks, I have tried both without and with the mainstack.
There is an option to "copy referenced files", I haven't tried that.
Could there be microscopic details in your script, like missing or superfluous spaces ?
Looking back on the first succesful standalone, I can see, that standalone was produces with reference to launcher.
Somehow, in my frustrations, I erased Launcher, and dont find a way to re-incorporate that in the project and application browsers.
Could that point to a solution ?

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

Re: Repairing the amnesia of standalones

Post by Klaus » Mon Sep 25, 2017 3:03 pm

Hi Kresten,
kresten wrote:The standalones just opens the Diary.livecode file even if livecode is closed
yes, sure, that was the meaning of this thread, not? :shock:
Sorry, now I'm completely puzzled!?

You wanted to distribute your app with an editable stack "e-diary" and that is what this is all about, didn't you?


Best

Klaus

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Repairing the amnesia of standalones

Post by bogs » Mon Sep 25, 2017 4:46 pm

kresten wrote:Sorry, I still can't make it work.
The standalones just opens the Diary.livecode file even if livecode is closed
I'm sorry kresten, maybe I was not clear enough in my explanation of how it is supposed to work, what your describing is indeed what is supposed to happen, i.e. -
The launcher is the executable that starts the program
...It launches the stack you want to be the working program, in your case, Diary.livecode
... Diary.livecode is supposed to contain all the working elements and code, and can be saved to itself since it is not the executable.
... The launcher is at most supposed to be like an introduction screen, after it has launched the stack file, it has done its job and should go away. You can of course code it to minimize instead, or alternately minimize while you are working on it in the IDE and change that to make it go away for distribution.
kresten wrote:Somehow, in my frustrations, I erased Launcher, and dont find a way to re-incorporate that in the project and application browsers.
I am assuming you mean it disappears when you open it, and not that you have actually deleted the file.
... If you are in the IDE when testing it, you may have to stop messages, then go to 'File/ Open stack (or recent) and re-open it. At that point, you should be able to bring it up in the project and application browsers. Remember to turn the messages back on once you have the stack open.

If you have actually deleted the file, simply make another one, this should be very easy since there should only be a very few lines of code in the stack or card section :)
Image

kresten
Posts: 152
Joined: Tue Sep 30, 2008 3:01 pm
Location: Copenhagen
Contact:

Re: Repairing the amnesia of standalones

Post by kresten » Tue Sep 26, 2017 12:39 pm

Thanks,
I think I have full understanding of the concepts but the name of the standalone-builder stack, diary.livecode ( where I placed your script),may easily be misunderstood as the the mainstack name e-diary.livecode, which the standaloned diary.livecode refuses to open. I therefore renamed the standalone-builder stack to mydiary.livecode ( replacing the two lines, where its script refers to diary with mydiary.) But same type of result.

on openStack
   put specialfolderpath("documents") & "/Phenomenalog 20.0.4" into tFolder
   if there is not a folder tFolder then
     create folder tFolder
   end if
   put tFolder & "/e-diary.livecode" into tTargetStack
   put specialfolderpath ("resources") & "/e-diary.livecode" into tSourceStack
   if there is not a file tTargetStack then
      put url("binfile:" & tSourceStack) into url("binfile:" & tTargetStack)
   end if
   start using stack "MyDiary"
   go stack tTargetStack
   hide stack "MyDiary"
end open stack

Same result, the standalone only opens MyDiary.livecode, even as the name of the standalone is just MyDiary

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Repairing the amnesia of standalones

Post by bogs » Wed Sep 27, 2017 11:18 pm

I've re-read this about 6 times now, I'm not sure I understand exactly where you are. Just to make sure I am reading this correctly -
The stack you are turning into the standalone, or launcher, is named "mydiary".
The stack you want it to launch is named "e-diary.livecode".

IF the above is correct, I noticed a couple problems, if you copied / pasted that code:

At the end you have "end open stack", and that should read "end openStack" (no space between open and stack).

As well, I would change this -
// start using stack "MyDiary" <- your stack is already running, you don't need to start using it
go stack tTargetStack
// hide stack "MyDiary" <- I would use 'set the iconic of stack "MyDiary" to true' instead of hide, at least while you are testing it.
I edited the paths to show only the relevant portions, since I am not running on a mac, I can't use the same folder paths you have setup, but you can see that it is essentially creating the folder and file.
Image
I think your path and file routine could be shorter, but would have to defer to what you were told above, again since I don't have a mac to test or code with.
Image

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

Re: Repairing the amnesia of standalones

Post by Klaus » Fri Sep 29, 2017 8:38 pm

Hi Bogs,
/ start using stack "MyDiary" <- your stack is already running, you don't need to start using it
this IS neccessary, if stack "e-diary.livecode" and other stacks that are not part of the standalone want to
make use of all the externals, libs and widgets that have been added to the standalone stack (MyDiary)!

If not, these externals etc would only be available for "MyDiary" all of its substacks.

@Kresten
I still don't understand what is not working here?

Hint:
name of stack <> name of stack FILE on disk
and
name of stack <> name of standalone
Know what I mean?

You can name your stack "MyDiary" and save it under the name of "YourDiary.livecode" on disk.
Same with standalone that you create from "MyDiary". You could name the standalone "Ludmilla.app"
but the stack name is still "MyDiary".

Please add this line to your script, maybe this will give us a hint why the tTarget stack in the users
docs folder does not open:
...
start using stack "MyDiary"
go stack tTargetStack
answer the result
## Maybe there will be a hint in the dialog
## If there is NO error, you will see an empty dialog and the stack should be opened
...

Best

Klaus

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

Re: Repairing the amnesia of standalones

Post by Klaus » Fri Sep 29, 2017 8:44 pm

Another idea! :D
Put the "openstack" handler into the script of the first card of stack "MyDiary" (the one you make a standalone from).
But maybe you already did this...

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Repairing the amnesia of standalones

Post by bogs » Sat Sep 30, 2017 2:25 am

Klaus wrote: Hi Bogs,
/ start using stack "MyDiary" <- your stack is already running, you don't need to start using it
this IS neccessary, if stack "e-diary.livecode" and other stacks that are not part of the standalone want to
make use of all the externals, libs and widgets that have been added to the standalone stack (MyDiary)!
My bad, I missed that part a page and a half back, and only ran the code in the last snippet :oops:
Carry on :)
Image

kresten
Posts: 152
Joined: Tue Sep 30, 2008 3:01 pm
Location: Copenhagen
Contact:

Re: Repairing the amnesia of standalones

Post by kresten » Tue Oct 03, 2017 2:46 pm

Hello, and thank you for all your help along the way, now it is fully functional :D :D :D :D :D

on openStack
   put specialfolderpath("documents") & "/Phenomenalog" into tFolder
   if there is not a folder tFolder then
     create folder tFolder
   end if
   put tFolder & "/e-diary.livecode" into tTargetStack
   put specialfolderpath ("resources") & "/e-diary.livecode" into tSourceStack
   if there is not a file tTargetStack then
      put url("binfile:" & tSourceStack) into url("binfile:" & tTargetStack)
   end if
-- -start using stack "MyDiary"
   go stack tTargetStack
--    set the iconic of stack "MyDiary" to true
hide stack "MyDiary"
quit stack "MyDiary.livecode"
end openStack

It works perfectly.
A miniature problem is, that the "MyDiary.livecode " window stays on desktop. It is easy to close manually, without hurting the standalone, and is anyhow hidden behind the daycards, but may confuse new users. As you see I scripted the quitting it, also tried "close stack "MyDiary.livecode" , but without success.
Maybe I should just let it be?

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

Re: Repairing the amnesia of standalones

Post by Klaus » Tue Oct 03, 2017 3:04 pm

Hi Kresten,

you cannot QUIT a single STACK, only CLOSE, so please remove that line!
And this: <hide stack "MyDiary"> does not work?


Best

Klaus

kresten
Posts: 152
Joined: Tue Sep 30, 2008 3:01 pm
Location: Copenhagen
Contact:

Re: Repairing the amnesia of standalones

Post by kresten » Tue Oct 24, 2017 1:00 pm

I postpone the miniature problem, facing a much worse:
Producing a standalone for windows seems to work, but opening in windows the menus doesn't appear.
I further copied the mainstack to windows, in order to try standaloning there, but the menus are already invisible there.
Any advice ?

Post Reply

Return to “Talking LiveCode”