How to save a stack file in the sandbox era?

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
Mag
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 802
Joined: Fri Nov 16, 2012 10:51 pm

How to save a stack file in the sandbox era?

Post by Mag » Wed Dec 14, 2016 6:43 pm

I'm working on an app for Mac were the user can save a stack file on disk via the ask file dialog of LiveCode.

Code: Select all

ask file "Save This File As:" with the title of stack stackName & ".abc" as sheet -- in a sandboxed app you need that the save as dialog returns a path with the extension, you cannot add it later
Unfortunately, when user deletes the extension in the dialog, then the stack is saved without it, so when you double click the file, the app is not launched.

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: How to save a stack file in the sandbox era?

Post by Klaus » Wed Dec 14, 2016 7:05 pm

Hi Mag,

who is the developer of that app? :D

Code: Select all

...
ask file "Save This File As:" with the title of stack stackName & ".abc" as sheet
put it into tFile2Save
if char -4 to -1 of tFile2Save <> ".abc" then
  put ".abc" after tFile2Save
end if
## Carry on with happy saving here...
...
Best

Klaus

Mag
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 802
Joined: Fri Nov 16, 2012 10:51 pm

Re: How to save a stack file in the sandbox era?

Post by Mag » Wed Dec 14, 2016 7:20 pm

Its me messier! :-)

Thank you for your precious suggestion, I will implement it in the not-sandboxed version.

About the sandboxed version there is a problem: you need that the save as dialog returns a path with the extension, you cannot add it later.


:-(

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: How to save a stack file in the sandbox era?

Post by Klaus » Wed Dec 14, 2016 7:28 pm

Oh, sorry, I was not aware of this!? :oops:

Mag
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 802
Joined: Fri Nov 16, 2012 10:51 pm

Re: How to save a stack file in the sandbox era?

Post by Mag » Sat Dec 17, 2016 11:34 am

Maybe I could ask for a name first, and then prompt with a save file dialog with the chosen name...

Post Reply