Save on Desktop instead of Applications folder
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Save on Desktop instead of Applications folder
When I choose to Save a stack LC always suggests Applications folder (on Mac), but I want it to be Desktop. Is there some preference or something else where I can default the suggested save location as Desktop instead of Applications folder.
uelandbob@gmail.com
Re: Save on Desktop instead of Applications folder
Standalone application settings -> General -> Default build folder (it's the last field below) 

Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
Re: Save on Desktop instead of Applications folder
Thanks MaxV
, but that seems only to apply when building standalone apps, not when saving regular LC stacks (File/Save As...)

uelandbob@gmail.com
Re: Save on Desktop instead of Applications folder
Hi uelandbob,
What about:
Best regards
Jean-Marc
Edit: Sorry I forgot "desktop" the correct syntax is
What about:
Code: Select all
put specialfolderpath() & "/ " & "myStack" into tFile
save stack "MyStack" as tFile
Jean-Marc
Edit: Sorry I forgot "desktop" the correct syntax is
Code: Select all
put specialfolderpath("desktop") & "/ " & "myStack" into tFile
save stack "MyStack" as tFile
Last edited by jmburnod on Wed Dec 31, 2014 11:13 am, edited 1 time in total.
https://alternatic.ch
Re: Save on Desktop instead of Applications folder
Thanks Jean Marc,
It is not big deal it is easy to choose a different folder each time I want to save a file, but your code can come in very handy in many situations
It is not big deal it is easy to choose a different folder each time I want to save a file, but your code can come in very handy in many situations

uelandbob@gmail.com
Re: Save on Desktop instead of Applications folder
The Save dialog opens to whatever folder is currently the defaultFolder. When you launch LiveCode, that's the Applications folder. To change it, do this in a script or from the message box:
You only need to do that once per session and after that it will stick unless a script changes it to something else later. The folder will reset on each launch, so you have to reset it each time. Or you can create a plugin that sets it, and have the plugin load when the IDE starts up.
Code: Select all
set the defaultFolder to specialfolderpath("desktop")
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Save on Desktop instead of Applications folder
Thanks Jacque,
Very good solution, even though I do not know how to write a plugin. Is that difficult? Where do you get info on how to do that? In the good old days of HyperCard there was this concept of Home stack. In Home stack you could just put the code on OpenStack handler. Does LiveCode have something similar to the Home stack.
Very good solution, even though I do not know how to write a plugin. Is that difficult? Where do you get info on how to do that? In the good old days of HyperCard there was this concept of Home stack. In Home stack you could just put the code on OpenStack handler. Does LiveCode have something similar to the Home stack.
uelandbob@gmail.com
Re: Save on Desktop instead of Applications folder
A plugin is just a regular stack that you can tell LC to launch at startup. You can put any handlers in there that you need and make it function like HC's Home stack script used to by putting the stack script into use. But for this one-time deal you wouldn't want to do that. You'd just want it to do the setup once and then go away.
So, make a new stack and in the card script put this:
Save the stack and move it into your Plugins folder. You can see where that is in LC preferences at the bottom of the Files & Memory pane ("User extensions".) If you don't have a Plugins folder yet, create one at that location. Note that the "user extensions" folder is the one that encloses the Plugins folder; don't point User Exentions to the plugins folder itself.
Restart LC and it will load your plugin.
You can now open the plugin stack by choosing it from the Development/Plugins menu and it will set the defaultfolder when it opens. But you probably want that to happen automatically, so choose Plugin Settings and select your stack from the top popup button. Select the radio button to start up the plugin "When LiveCode starts up" and set it to open as "invisible". The next time you launch LC the stack will open invisibly, the preopencard handler will run, and the defaultfolder will be set.
As written, this leaves the stack open in RAM. I do that because I have dozens of handlers in the stack script that I use during development. My preOpenStack handler in the first card inserts the stack script into the backscripts and they are available at all times, just like HC Home scripts used to do. If you don't want the stack hanging around, add a "close this stack" command to the preopenstack handler and it will go away.
So, make a new stack and in the card script put this:
Code: Select all
on preOpenStack
set the defaultFolder to specialFolderPath("desktop")
end preOpenStack
Restart LC and it will load your plugin.
You can now open the plugin stack by choosing it from the Development/Plugins menu and it will set the defaultfolder when it opens. But you probably want that to happen automatically, so choose Plugin Settings and select your stack from the top popup button. Select the radio button to start up the plugin "When LiveCode starts up" and set it to open as "invisible". The next time you launch LC the stack will open invisibly, the preopencard handler will run, and the defaultfolder will be set.
As written, this leaves the stack open in RAM. I do that because I have dozens of handlers in the stack script that I use during development. My preOpenStack handler in the first card inserts the stack script into the backscripts and they are available at all times, just like HC Home scripts used to do. If you don't want the stack hanging around, add a "close this stack" command to the preopenstack handler and it will go away.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Save on Desktop instead of Applications folder
Thanks Jacque, this is brilliant
This will make it possible to make my own box of ready made scripts to use each time I create a new stack.

uelandbob@gmail.com