Can't find my stack following Creating Standalone Lesson

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
spencer
Posts: 71
Joined: Mon May 09, 2011 3:01 pm

Can't find my stack following Creating Standalone Lesson

Post by spencer » Thu Feb 02, 2012 1:23 pm

There is a great tutorial LiveCode Lessons | How To - Step-By-Step Guides To Tasks In LiveCode | How do I save custom properties in a standalone application?


http://lessons.runrev.com/s/lessons/m/4 ... pplication


So now I'm doing the lesson, following the directions, and getting an error message that it can't find the stack I've created after saving it as a standalone. I created the launcher, the main application, put this handler in the stack script of the launcher:

on openStack
open stack "Main Application.livecode"
close stack "Launcher"
end openStack

The error message is:

stack "Untitled 1": execution error at line 5 (Chunk: can't find stack), char 4

Line 5 is blank. The last line is line 4.

It must be the path problem. Anyone done it?

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Can't find my stack following Creating Standalone Lesson

Post by jmburnod » Thu Feb 02, 2012 7:41 pm

Hi,
It must be the path problem
Yes, you're right
This function return the path of the folder its contain a standalone or a stack

Code: Select all

function MainStackFolder
   put the filename of this stack into rMainStackFolder 
   put the platform  into tPlatForm
   put the environment into pEnv
   put the itemdel into OID
   set the itemdel to "/"
   put the num of items of rMainStackFolder into nbF
    if tPlatForm = "MacOS" then 
      if pEnv = "standalone application" then
         delete item (nbF-3) to nbf of rMainStackFolder
      end if
      if pEnv = "development" then
         delete last item of rMainStackFolder
      end if
   else
      delete last item of rMainStackFolder
   end if
   set the itemdel to OID
   return  rMainStackFolder
end MainStackFolder
Best regards

Jean-Marc
https://alternatic.ch

spencer
Posts: 71
Joined: Mon May 09, 2011 3:01 pm

Re: Can't find my stack following Creating Standalone Lesson

Post by spencer » Sat Feb 04, 2012 1:54 pm

Thanks for the code. I put it in a button on the "Launcher" stack, and get this path when I click it:

/Volumes/Guild/Users/Silence/Documents/Mac/LiveCode Game Academy/GA Week 6/week6stacks 2/myStandAlone

My "Launcher" stack and my "Main Application" stack are both in that folder, screen shot below:
Error LiveCode Path.tiff
Path Problem Screenshot
Error LiveCode Path.tiff (71.11 KiB) Viewed 7107 times
The stack script of "Launcher" is:
on openStack
    
open stack "Main Application.livecode"
    
close stack "Launcher"
end openStack

The spelling is correct. Then I redid it by copying and pasting the name, didn't fix it. Why is the error message saying it can't find the stack on line 5, when line 5 has no code? I am at a total loss. OK, I will delete the preferences file, and report back. ???

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Can't find my stack following Creating Standalone Lesson

Post by jmburnod » Sat Feb 04, 2012 3:34 pm

Hi,

Replace your openstack script with this script:

Code: Select all

on openStack
    global gPathFolder
   put MainStackFolder() into gPathFolder
   put gPathFolder&"/"&"Main Application.livecode" into tTheMain
   open stack tTheMain
       
   close stack "Launcher" -- why ?
end openStack

function MainStackFolder
   put the filename of this stack into rMainStackFolder 
   put the platform  into tPlatForm
   put the environment into pEnv
   put the itemdel into OID
   set the itemdel to "/"
   put the num of items of rMainStackFolder into nbF
    if tPlatForm = "MacOS" then 
      if pEnv = "standalone application" then
         delete item (nbF-3) to nbf of rMainStackFolder
      end if
      if pEnv = "development" then
         delete last item of rMainStackFolder
      end if
   else
      delete last item of rMainStackFolder
   end if
   set the itemdel to OID
   return  rMainStackFolder
end MainStackFolder
Best regards

Jean-Marc
https://alternatic.ch

spencer
Posts: 71
Joined: Mon May 09, 2011 3:01 pm

Re: Can't find my stack following Creating Standalone Lesson

Post by spencer » Sat Feb 04, 2012 5:37 pm

OK, but this is a LiveCode Lesson, straight off the web page, no alterations. Why doesn't it work?

Your code does make it work, until it tries to close the launcher stack, then it can't find that either. Applying your code to the line,
closeStack "Launcher"
it works, but now I can't get to edit the launcher stack script, as it closes and leaves me with the Main Application. If I type into the message box,

edit script of stack "Launcher"

the stack is not found. It is still the same path problem. All the same, there must be a way to edit it.

spencer
Posts: 71
Joined: Mon May 09, 2011 3:01 pm

Re: Can't find my stack following Creating Standalone Lesson

Post by spencer » Sat Feb 04, 2012 6:04 pm

Trashing my preferences just deletes my recents list in the openFile menu, but does not take care of the problem. I still get the "can't find stack" error message opening Launch. I'd rather have the recents list, so put my preferences back. LiveCode did crash with that last opening of the launcher stack, so I'll reinstall it.
My paid old version hangs for the same reason, but the line identified as the problem is correct: line 3,
Last edited by spencer on Sat Feb 04, 2012 6:57 pm, edited 1 time in total.

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: Can't find my stack following Creating Standalone Lesson

Post by sturgis » Sat Feb 04, 2012 6:29 pm

When you create a standalone it puts the .exe and all the stuff it needs into a folder. If you named it launcher as in the directions then there is a launcher folder (if you've made the standalone multiple times there will be numbered launcher folders) The default path for executables like this on startup is their current location. So if you place your main application.livecode stack in the same folder right next to the standalone it will be able to find it.

There are some nifty things you can do though. You can distribute the launcher (the .exe) with the required stacks stored in custom properties of the stack. Then when you run the launcher have it check to see if the stack file exists and if not extract it and place it in the proper location. Or you can do the same check, and if it doesn't exist get the most up to date stack from a URL and save it to wherever you need.

It does say the following in the lesson..
Building a standalone

Now build the Launcher stack into a standalone, once the standalone is built copy the Main Application.rev file into the same folder as the standalone.

If you did this and it still doesn't work, check for typos in the stack name compared to the "open stack" statement. Also, if you're actively working with the ide (this may sound like a silly thing to point out) make sure you're actually working with the .exe and not still poking around with the original launcher stack in the ide.

Worst case if you're still having problems, adjust your launcher stack so that a) it only launches the second stack on a button click, then add soem other stuff so that you can look at the defaultfolder and a "put the files..." so you can see where you are and what files are there. Then rebuild it, find the newest folder, place the main application.livecode stack file next to it and see what happens.

spencer
Posts: 71
Joined: Mon May 09, 2011 3:01 pm

Re: Can't find my stack following Creating Standalone Lesson

Post by spencer » Sat Feb 04, 2012 8:03 pm

That was the problem:

Also, if you're actively working with the ide (this may sound like a silly thing to point out) make sure you're actually working with the .exe and not still poking around with the original launcher stack in the ide.

I was opening the livecode Launcher, instead of the app Launcher. Here is what works.
Error solved Launcher Path.tiff
Error solved Launcher Path.tiff (34.68 KiB) Viewed 7071 times

Thanks!

Post Reply