Ins and Outs of start using
kray at sonsothunder.com
Thu Dec 15 18:02:11 CST 2011
On Dec 15, 2011, at 4:36 PM, Michael Doub wrote:
> Can someone help me understand the proper usage of start using? I have a stack that contains a number of scripts that I would like to use as part of a library. I keep running into a failure situation where the stack that I wish to "start using" can't be found. I have the main stack and the library stack in the same directory.
> In the code below, what directory is xyz.livecode expected to be in? with the engine? with the main stack? I have been able to force it to work by always coding the complete path but I have see the code used by others and I would like to clearly understand the default behaviours.
It is in the location identified by "the defaultFolder" (or "the directory"). This is automatically set to the folder containing the application that's currently running the engine unless it is changed to some where else with "set the defaultFolder to <path>".
A common implementation is to set the defaultFolder to the folder that contains the first stack you open (so you can refer to all others by relative paths):
on preOpenStack -- of the first stack you open
set the itemDel to "/"
put item 1 to -2 of the fileName of this stack into tMyFolder
set the itemDel to ","
set the defaultFolder to tMyFolder
Sons of Thunder Software, Inc.
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/
More information about the use-livecode