Page 1 of 1

Path question

Posted: Thu Jul 23, 2015 6:43 pm
by rumplestiltskin
The user guide has an example of determining the path of a file:

answer file "Choose a file"; put it

What about if I just want to know the path of the currently open stack? My stack (which will be the double-clickable) will call another stack to which the changes the user makes will be written. What code can I use in the script to open that stack if I don't know where the user will install my app and its support stacks?

Thanks!

Barry

Edit: All my stacks will be in the same folder.

Re: Path question

Posted: Thu Jul 23, 2015 6:54 pm
by FourthWorld
See the stack's filename property.

Re: Path question

Posted: Fri Jul 24, 2015 3:09 am
by ghettocottage
On one project I did something like this:

Code: Select all

global gDefaultFolder

/*********************************************************
stuff to do on open stack
**********************************************************/

on openStack

      --set the gDefaultFolder to stack location
   set the itemDelimiter to "/"
   get the effective fileName of this stack
   set the defaultFolder to item 1 to -2 of it
   put the defaultFolder into gDefaultFolder

end openStack

Re: Path question

Posted: Fri Jul 24, 2015 6:30 am
by rumplestiltskin
Thank you for not smacking me upside the head. :oops:
Before I returned to this thread I did a search at the tutorials page for "path" and found the filename property. I've been away from Livecode for too long. I'm retiring in December and will finally start spending many more hours working with LC. If I keep working with it, I may remember more of this "little" code that is so essential.

Regards,
Barry