Repairing the amnesia of standalones

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

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Re: Repairing the amnesia of standalones

Postby kresten » Wed Sep 13, 2017 1:41 pm

‪Dear Bogs
As to the error message, I found some unneccesary code in the card script of the mainstack, which I erased, Now the launcer tells of no errors, it just doesnt open the stack.
The OS is X ElCapitan v 10.11.6
The livecode is 6.7.8
I am grateful for your offer to have a look at my monster of a stack. As it includes references to some folders and a html file, i include everything. However its final functioning supposes the installation of 12 special fonts ("Glyph fonts) , but they are not essential to the functioning of a launcher.
I am curious whether the zip.file can be uploaded with this
Else I hope to get your advice how that can be accomplished

/Users/Kresten/Desktop/20.0.4 Klon for launcher/Phenomenalog 20.0.4.zip
kresten
 
Posts: 85
Joined: Tue Sep 30, 2008 3:01 pm
Location: Copenhagen

Re: Repairing the amnesia of standalones

Postby kresten » Wed Sep 13, 2017 2:33 pm

Dear Bogs
As to the error message, I found some unneccesary code in the card script of the mainstack, which I erased, Now the launcer tells of no errors, it just doesnt open the stack.
The OS is X ElCapitan v 10.11.6
The livecode is 6.7.8
I am grateful for your offer to have a look at my monster of a stack. As it includes references to some folders and a html file, i include everything. However its final functioning supposes the installation of 12 special fonts ("Glyph fonts) , but they are not essential to the functioning of a launcher.
I am curious whether the zip.file can be uploaded with this
No it was too big, It told me, that max site was 2 Mb, , now I try with the barest minimum 516 KB, but then it tells me that max allowed size is 256 KB.
kresten
 
Posts: 85
Joined: Tue Sep 30, 2008 3:01 pm
Location: Copenhagen

Re: Repairing the amnesia of standalones

Postby bogs » Wed Sep 13, 2017 3:24 pm

Hm.
kresten wrote:As to the error message, I found some unneccesary code in the card script of the mainstack, which I erased, Now the launcer tells of no errors, it just doesnt open the stack.
What happens when you step through the launch of the working stack in the debugger?
Image
bogs
 
Posts: 376
Joined: Sat Feb 25, 2017 10:45 pm

Re: Repairing the amnesia of standalones

Postby jacque » Wed Sep 13, 2017 8:04 pm

I am afraid I dont understand Jaques advice and its reference to app and bundle. My mainstack and its folders are placed on my desktop. will I have to go elsewhere ?


It doesn't matter where the main folder is, the desktop is fine. On OS X, an app is really a folder and inside that folder are all the files the app needs to function. This special folder is called a "bundle". You can see what I mean if you right-click on any app and choose "Show package contents" from the contextual menu.

The path you are using is relative to the location of the mainstack, which is inside the app bundle. You need to look for the file in the folder that the app is in.This lesson explains how to do that, scroll down to the topic "Mac application bundles".
http://lessons.livecode.com/m/4071/l/7869-how-can-i-get-the-path-to-the-folder-a-stack-file-resides-in

If your standalone is running on Windows or Linux, the same lesson describes how to the get enclosing folder for those too.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
 
Posts: 3794
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN

Re: Repairing the amnesia of standalones

Postby kresten » Mon Sep 18, 2017 12:19 pm

I have now tried with a script referring to the effective filename, but launcher doesnt open mainstack and returns no errors.

on openStack
open stack "/Users/Kresten/Desktop/20.0.4 Klon for launcher/Phenomenalog 20.0.4/Personal diary/Diaryproper/e-diary.livecode"
-- open stack "e-diary.livecode"
if the result is not empty then
answer the result &&"(" & sysError() &")"
exit to top
end if
hide this stack
end openStack

Have I misunderstood everything ?
kresten
 
Posts: 85
Joined: Tue Sep 30, 2008 3:01 pm
Location: Copenhagen

Re: Repairing the amnesia of standalones

Postby Klaus » Mon Sep 18, 2017 12:46 pm

Hi Kresten,

your script surely works, but not as you would exspect! :D
Code: Select all
on openStack
   open stack "/Users/Kresten/Desktop/20.0.4 Klon for launcher/Phenomenalog 20.0.4/Personal diary/Diaryproper/e-diary.livecode"
   ###...

   ## The first line WILL in fact open that stack e-diary, but now THIS STACK = e-diary and you hide it with this line :-)
   ## hide this stack

  ## Add the name of the launcher stack and it will work:
  hide stack "launcher or how you named it"
end openStack

Best

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

Re: Repairing the amnesia of standalones

Postby kresten » Mon Sep 18, 2017 3:05 pm

So many thanks !!!!
Now its basic operation works ok. The amnesia has been cured !
HOWEVER: A central aspect of the mainstack is the functioning of a substack "My cyberspaces", permitting the user to make / and baptise/ links to internet sites. (Already installed are links to wikipedia, advanced google, google translate etc.) But the launcher version is unable to open the livecode browser.
Any advice to solve this problem ?
kresten
 
Posts: 85
Joined: Tue Sep 30, 2008 3:01 pm
Location: Copenhagen

Re: Repairing the amnesia of standalones

Postby Klaus » Mon Sep 18, 2017 7:03 pm

Hi Kresten,

add all libraries, widgets, externals etc. that you need in your stacks to the LAUNCHER stack, the stack you create the standalone from.
Then add this line to that stack:
Code: Select all
on openStack
   start using stack "launcher or how you named it"
   ## Or:
   ## start using THIS stack
   ## Will also work at this point!

   # Now all other stacks that you open with your standalone can access the widgets etc...!
   open stack "/Users/Kresten/Desktop/20.0.4 Klon for launcher/Phenomenalog 20.0.4/Personal diary/Diaryproper/e-diary.livecode"
...

Best

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

Re: Repairing the amnesia of standalones

Postby kresten » Tue Sep 19, 2017 12:53 pm

Thank you
Your last advice may be essential to solving the problem, but I have an inet browser, which works as a substack in the mainstack.
I quote here the script:

local sBrowserId = ""

# Opens the browser and sets initial url and position.
command browserInit
local tBrowserId
put revBrowserOpen(the windowId of this stack, "http://www.google.com") into tBrowserId
browserEnsure tBrowserId
put tBrowserId into sBrowserId
revBrowserSet sBrowserId, "rect", the rect of graphic "Browser Rect" of me
revBrowserSet sBrowserId, "scrollbars", true
end browserInit

# Closes the browser
command browserFinalise
browserEnsure sBrowserId
revBrowserClose sBrowserId
end browserFinalise

# Ensure that a browser is present
command browserEnsure pBrowserId
if pBrowserId is not an integer then
# Insert custom error handling here if required, eg close any open browsers and call browserInit.
end if
end browserEnsure

# Navigate back
command browserBack
browserEnsure sBrowserId
revBrowserBack sBrowserId
end browserBack

# Navigate forward
command browserForward
browserEnsure sBrowserId
revBrowserForward sBrowserId
end browserForward

# Refresh browser
command browserRefresh
browserEnsure sBrowserId
revBrowserRefresh sBrowserId
end browserRefresh

# Stop current navigation
command browserStop
browserEnsure sBrowserId
revBrowserStop sBrowserId
end browserStop

# Go to url
command browserGo pUrl
local tUrl
if ":" is not in pUrl then
# No protocol supplied, assume that the user meant http
put "http://" & pUrl into tUrl
else
put pUrl into tUrl
end if
browserEnsure sBrowserId
revBrowserNavigate sBrowserId, tUrl
end browserGo

# Callback handler. This message is sent by the browser object when navigating to a url begins.
on browserNavigateComplete pInstanceId, pUrl
browserUpdateUrlField pUrl
end browserNavigateComplete

# Update the url field to pUrl
command browserUpdateUrlField pUrl
put pUrl into field "url" of me
end browserUpdateUrlField


Can you understand/explain why this doesn't work in the launcher - and how we may repair it ?
kresten
 
Posts: 85
Joined: Tue Sep 30, 2008 3:01 pm
Location: Copenhagen

Re: Repairing the amnesia of standalones

Postby Klaus » Tue Sep 19, 2017 3:04 pm

Can you understand/explain why this doesn't work in the launcher?

In the LAUNCHER? Or the editable stack?

Did you add all externals, especially the Browser external, to the standalone?
And did you "start using this stack"?
Klaus
 
Posts: 9488
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany

Previous

Return to Talking LiveCode

Who is online

Users browsing this forum: No registered users and 2 guests