defaultfolder

Iden Rosenthal iden at idenrosenthal.com
Wed Apr 5 11:10:20 EDT 2006


It is Dreamcard 2.7 on OS X 10.4.5
The code goes:

on makeNewStack
   -- makes a new stack out of the marked cards
   -- presumably the cards will have been marked by the Sort button  
of the Sort stack
   lock messages -- we don't want to trigger any newcard actions
   put the script of this stack into newStackScript
   go first marked cd
   put the long id of this cd into placeHolder
   set the height of the templateStack to the height of placeHolder
   set the width of the templateStack to the width of placeHolder
   set top of the templateStack to top of placeHolder + 150
   set left of the templateStack to left of placeHolder + 180

   put number of marked cds into numMarked

   ask "Name for New Stack?"
   put it into newStackName
   create stack newStackName
   -- set the mainstack of stack newstackname to mainstackname --  
lets have them all be independent stacks

   go placeHolder
   copy this cd to stack newStackName
   unmark this card

   lock screen

   put 1 into count

   repeat with k = 2 to numMarked
     go next marked cd
     copy this cd to stack newStackName
     unmark this card

     add 1 to count
   end repeat


   unlock messages
   go first card of stack newStackName
   set the script of stack newStackName to newStackScript
   delete this card -- the first card of a create'd stack is blank

   unlock screen
   reset the templateStack
   setdefaultpath
   beep 3
   answer "Created new stack " & newStackName & " with " & count & "  
cards."

end makeNewStack

and setdefaultpath is :

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?

On Apr 5, 2006, at 11:01 AM, David Burgun wrote:

> It should work ok, what is the exact code, which version of RunRev  
> and what platform?
>
> All the Best
> Dave
>
>
> On 5 Apr 2006, at 15:56, Iden Rosenthal wrote:
>
>> I am having a terrible time with my defaultfolder being reset to  
>> "/". I am keeping a collection of related stacks in one folder and  
>> my scripts rely on opening stacks within that folder. I have a  
>> setdefaultfolder script that parses the name of the stack and sets  
>> the defaultfolder variable to be the folder name where the stacks  
>> are stored. But when one of my scripts creates a new stack,  
>> despite the fact that the setdefaultfolder handler is called, the  
>> defaultfolder variable seems to be set to "/" thus causing a  
>> script failure. What is it I don't understand?
>> _______________________________________________
>> use-revolution mailing list
>> use-revolution at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your  
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-revolution
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
>




More information about the use-livecode mailing list