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: 88
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: 88
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: 391
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: 3798
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: 88
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: 9496
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: 88
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: 9496
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: 88
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: 9496
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany

Re: Repairing the amnesia of standalones

Postby kresten » Wed Sep 20, 2017 2:59 pm

Dear Klaus
After I found out, that the externals were to be included in the standalone settings of the launcher it now works perfectly !!!! :D :D :D :D :D
Thank you for your patience and your efforts.
I may come back here concerning minor details, but today I am just happy and grateful
best regards from Kresten
kresten
 
Posts: 88
Joined: Tue Sep 30, 2008 3:01 pm
Location: Copenhagen

Re: Repairing the amnesia of standalones

Postby kresten » Thu Sep 21, 2017 1:27 pm

Hello
I am afraid I still need some help-
I want of course to publish, so the launcher should not refer to the long effective filename on my computer, but just to the folder of the application. I tried to abbreviate the reference, omitting the layers above the application, but can't make it work.
from
open stack "/Users/Kresten/Desktop/20.0.4 Klon for launcher/Phenomenalog 20.0.4/Personal diary/Diaryproper/e-diary.livecode"
I tried to address as
open stack "Phenomenalog 20.0.4/Personal diary/Diaryproper/e-diary.livecode"
But this will not work.
How can I repair ?
kresten
 
Posts: 88
Joined: Tue Sep 30, 2008 3:01 pm
Location: Copenhagen

Re: Repairing the amnesia of standalones

Postby Klaus » Thu Sep 21, 2017 1:55 pm

HI Kresten,

do this:
1. Add your "e-diary.livecode" stack to the standalone via the "Copy files..." tab in the standalone builder settings.
2. In the "launcher" stack add this to the stack script:
Code: Select all
on openStack
   ## Change "Diary" to whatever folder name you like.
   ## It is good style to have your documents inside of a folder in the users Documenta folder!
   put specialfolderpath("documents") & "/Diary" into tFolder
   if there is not a folder tFolder then
      create folder tFolder
   end if
   
   ## Create pathname inside of that folder:
   put tFolder & "/e-diary.livecode" into tSourceStack
   
   ## Here you find all the stuff you added with the "Copy files..." tab:
   put specialfolderpath("resources") & /"e-diary.livecode" into tTargetStack
   
   ## Don't overwrite existing stacks!
   if there is not a file tSourceStack then
     
      ## Copy stack to users docs folder:
      put url("binfile:" & tSourceStack) into url("binfile:" & tTargetStack)
   end if
   
   ## !!!
   start using stack "the launcher stack name goes here..."
   
   ## Now we have this stack in a folder with write permissions!
   go stack tTargetStack
   hide stack "the launcher stack name goes here..."
end openStack

That's it and your stack can be saved, usually "on closestack"!


Best

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

Re: Repairing the amnesia of standalones

Postby kresten » Sat Sep 23, 2017 1:55 am

‪Thanks for the advice, but I am stuck in my attempts to implement.
I produced a new mainstack, named Diary
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 ( this line produced an eror like double binary)
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 was in a dilemma, because the copy files tab in the standalone settings explicates that this should not be stacks (so I just refered to the acompanying folders). wheres the neighbouring Stacks tab made it possible to include the main stack,so I tried that, so it figured together with the "Diary".stack, (which the standalonesettings window informs to refer to "Launcher").
Standaloning here ran into an eternal process.
I then tried to remove the reference to the mainstack back into the Copy files tab.
After that , I got a "diary" standalone, but it doesnt open anything, and when opened is refered to as launcher.

I should tell that while experimenting with this i examined the application browser and found a Launcher mainstack, which I deleted.
It was hopeless before and is hopeless after.
Can I have done lasting damage with this ?
Where should I go from now ?
kresten
 
Posts: 88
Joined: Tue Sep 30, 2008 3:01 pm
Location: Copenhagen

Re: Repairing the amnesia of standalones

Postby Klaus » Sat Sep 23, 2017 11:36 am

Sorry, my fault:
Code: Select all
...
put tFolder & "/e-diary.livecode" into tSourceStack
## put specialfolderpath ("resources") & "e-diary.livecode" into tTargetStack
## You forgot the SLASH:
put specialfolderpath ("resources") & "/e-diary.livecode" into tTargetStack

## I was looking for the wrong stack:
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"
...
Klaus
 
Posts: 9496
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 6 guests