Quick programming note:
>   put the itemdelimiter into originalDelim
>  ...
>     set the itemdelimiter to originalDelim

is not necessary the way you have structured your function.  Rev will
consider the itemDelimiter at the start of each handler to be the default
itemDelimiter, which is usually a comma.

" set the itemdelimiter to "/"  --is not a global setting that applies to
all handlers and all scripts, only the current one.

However, in Applescript,the  text item delimiter is a global setting, so
storing the old, and resetting is the best idea.

Hope this helps.

Jim Ault
Las Vegas

On 6/7/07 7:42 AM, "David Bovill" <[EMAIL PROTECTED]> wrote:

> function file_GetRelativePath someFileOrFolder, baseFolder, @commonPath
>     put the itemdelimiter into originalDelim  -->
>     set the itemdelimiter to "/"
>     put empty into commonPath
>     put someFileOrFolder into relativePath
>     put 0 into itemNum
>     repeat with itemNum = 1 to the number of items of baseFolder
>         put item itemNum of baseFolder into basePathComponent
>         put item itemNum of someFileOrFolder into somePathComponent
> 
>         if somePathComponent is basePathComponent then
>             next repeat
>         else
>             subtract 1 from itemNum
>             exit repeat
>         end if
>     end repeat
> 
>     put item 1 to itemNum of someFileOrFolder into commonPath
>     delete item 1 to itemNum of relativePath
> 
>     delete item 1 to itemNum of baseFolder
>     put the number of items of baseFolder into upBits
>     repeat upBits
>         put "../" before relativePath
>     end repeat
> 
>     set the itemdelimiter to originalDelim
>     put "/" after commonpath
>     return relativePath
> end file_GetRelativePath


_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to