SAVING DATA TO STANDALONE APPLICATION ISSUE
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
SAVING DATA TO STANDALONE APPLICATION ISSUE
Two stacks
BEAKEREXPEDITESLAUNCH4 (splash stack)
BEAKEREXPEDITES3 (main app)
Tried the splash card method using a button with the script below to launch the main app in the stand alone application. The stand alone app builds without an issue. New data that is entered in fields in the main app are not saved on CloseStack in the standalone app.
Button script in BEAKEREXPEDITESLAUNCH4 (splash stack)
on mouseUp
set the itemDelimiter to "/"
if the environment is "standalone application" then
get the effective fileName of this stack
set the defaultFolder to item 1 to -2 of it
if there is a stack "BEAKEREXPEDITES3" then
open stack "BEAKEREXPEDITES3"
close stack "BEAKEREXPEDITESLAUNCH4"
else
answer warning "stack " & the defaultFolder & "BEAKEREXPEDITES3 not found"
end if
else
get the effective fileName of this stack
set the defaultFolder to item 1 to -2 of it
open stack "BEAKEREXPEDITES3"
go to stack "BEAKEREXPEDITES"
close stack "BEAKEREXPEDITESLAUNCH4"
end if
end mouseUp
The main app (BEAKEREXPEDITES3) script contains
On CloseStack
Save this stack
Pass CloseStack
End CloseStack
BEAKEREXPEDITESLAUNCH4 (splash stack)
BEAKEREXPEDITES3 (main app)
Tried the splash card method using a button with the script below to launch the main app in the stand alone application. The stand alone app builds without an issue. New data that is entered in fields in the main app are not saved on CloseStack in the standalone app.
Button script in BEAKEREXPEDITESLAUNCH4 (splash stack)
on mouseUp
set the itemDelimiter to "/"
if the environment is "standalone application" then
get the effective fileName of this stack
set the defaultFolder to item 1 to -2 of it
if there is a stack "BEAKEREXPEDITES3" then
open stack "BEAKEREXPEDITES3"
close stack "BEAKEREXPEDITESLAUNCH4"
else
answer warning "stack " & the defaultFolder & "BEAKEREXPEDITES3 not found"
end if
else
get the effective fileName of this stack
set the defaultFolder to item 1 to -2 of it
open stack "BEAKEREXPEDITES3"
go to stack "BEAKEREXPEDITES"
close stack "BEAKEREXPEDITESLAUNCH4"
end if
end mouseUp
The main app (BEAKEREXPEDITES3) script contains
On CloseStack
Save this stack
Pass CloseStack
End CloseStack
Re: SAVING DATA TO STANDALONE APPLICATION ISSUE
Hi,
Is the "splash stack" in its own stack file? And is the "main" stack in its own stack file as well? And now is the main stack then attached to the splash stack via the "Standalone Settings" of the splash stack?
Please let us know...
Craig
Is the "splash stack" in its own stack file? And is the "main" stack in its own stack file as well? And now is the main stack then attached to the splash stack via the "Standalone Settings" of the splash stack?
Please let us know...
Craig
Re: SAVING DATA TO STANDALONE APPLICATION ISSUE
What platform are you running the standalone on? Where is it placed? There are lots of locations where write permissions will not normally be available as standard.
Re: SAVING DATA TO STANDALONE APPLICATION ISSUE
Mac app bundles cannot save to themselves. To save the main stack it has to be moved out of the bundle and into a writeable location like the documents folder or the app support folder. Apple prefers the app support folder.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: SAVING DATA TO STANDALONE APPLICATION ISSUE
Thanks. The issue seems to be on the Mac only. The Windows standalone app build works well and new data is saved to the data stack. However, it is not working on the Mac OS. How do I move it from the bundle to the Apple support folder?
Re: SAVING DATA TO STANDALONE APPLICATION ISSUE
Hi,
Is the "splash stack" in its own stack file? And is the "main" stack in its own stack file as well? And now is the main stack then attached to the splash stack via the "Standalone Settings" of the splash stack?
Please let us know...
Craig
Yes both the "splash stack" and the "main" stack are separate stack files and the "main" stack is attached to the "splash stack" in the "Stand Alone" settings. The issue seems to be on the Mac only. The Windows standalone app build works well and new data is saved to the data stack. However, it is not working on the Mac OS. Another reply to my post stated that I should move the "main" stack to the Apple support folder and out of the bundle. - Jorge
Is the "splash stack" in its own stack file? And is the "main" stack in its own stack file as well? And now is the main stack then attached to the splash stack via the "Standalone Settings" of the splash stack?
Please let us know...
Craig
Yes both the "splash stack" and the "main" stack are separate stack files and the "main" stack is attached to the "splash stack" in the "Stand Alone" settings. The issue seems to be on the Mac only. The Windows standalone app build works well and new data is saved to the data stack. However, it is not working on the Mac OS. Another reply to my post stated that I should move the "main" stack to the Apple support folder and out of the bundle. - Jorge
Re: SAVING DATA TO STANDALONE APPLICATION ISSUE
The main stack in the bundle would only be used as a resource on first launch. After it is moved to the support folder, the copy is where the app should read and write to the stack. So you need to check if the copy exists when the standalone is launched, and do the copying if the file isn't there.
From the top of my head, untested:
Code: Select all
on openStack -- in the script of card 1 of the splash stack
put specialFolderPath("support") & "/main.livecode" into tMainStack
if there is no file tMainStack then
put url ("binfile:" & specialFolderPath("resources" & "/main.livecode") into url ("binfile:" & tMainStack)
end if
-- any other commands
end openStack
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: SAVING DATA TO STANDALONE APPLICATION ISSUE
Perfect. Thank you.