Path question

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
rumplestiltskin
Posts: 223
Joined: Wed Jun 21, 2006 7:33 pm
Contact:

Path question

Post by rumplestiltskin » Thu Jul 23, 2015 6:43 pm

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.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10052
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Path question

Post by FourthWorld » Thu Jul 23, 2015 6:54 pm

See the stack's filename property.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

ghettocottage
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 366
Joined: Tue Apr 10, 2012 9:18 am

Re: Path question

Post by ghettocottage » Fri Jul 24, 2015 3:09 am

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

rumplestiltskin
Posts: 223
Joined: Wed Jun 21, 2006 7:33 pm
Contact:

Re: Path question

Post by rumplestiltskin » Fri Jul 24, 2015 6:30 am

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

Post Reply