defaultfolder

Jim Ault JimAultWins at yahoo.com
Thu Apr 6 05:25:21 EDT 2006


On 4/5/06 8:10 AM, "Iden Rosenthal" <iden at idenrosenthal.com> wrote:

> on setdefaultpath
>    put the filename of this stack into fullpath
>    set the itemDelimiter to "/"
>    put item 1 to (number of items in fullpath - 1) of fullpath & "/"
> into SoulGuidingFolder
>    set the defaultfolder to SoulGuidingFolder
>    set the itemDelimiter to ","
> end setdefaultpath
> 
> It would appear that setdefaltpath returns "/" which would seem to
> mean that item 1 to the number of items in fullpath - 1 is returning
> empty. So why would filename return empty? Is it because the stack
> that has been created has not been saved yet? Is there a way around
> this?

First of all, in any application, if a file exists only in RAM, it has no
path name since it does not exist on the hard drive yet. The filename of an
unsaved stack is empty, which is why your handler sets the defaultfolder to
"/".

The answer this question... where would you save it if you did it manually?

If it is the same folder all the time, then use that as the path.
If it will be different, you need to allow the user to choose the path, or
define some method to
determine it (like folder walk)
or 
create it (like Documents/ create folder "Guiding"/ create subfolder
"SoulGuiding"


> on setdefaultpath
>    put the filename of this stack into fullpath
if fullpath is empty then
--not saved yet
--ask user or take action

>    set the itemDelimiter to "/"
>    put item 1 to (number of items in fullpath - 1) of fullpath & "/"
> into SoulGuidingFolder
>    set the defaultfolder to SoulGuidingFolder
--    set the itemDelimiter to "," --not necessary to reset in this case
since each handler keeps its own itemDel and lineDel
> end setdefaultpath


Hope this helps

Jim Ault
Las Vegas






More information about the use-livecode mailing list