hi michael,
a common way do this is to use
tPathDelimiter = "\" -- or: the last char of the moviepath
the itemdelimiter = tPathDelimiter
tFileName = the last item of tPath
cheers,
valentin
Mendelsohn, Michael wrote:
is it the # of the last element in a list?
Sorry, Buzz. I should've been clearer. I'm looking for a quick way
to
take a path (string) and chop it down to just the file name. I came
up
with this:
on reduceToFileName(thePath)
-- chops off all slashes (char 92) and returns just the file name.
repeat with i = thePath.length down to 1
if(charToNum(thePath.char[i]) = 92) then
return thePath.char[(i+1)..(thePath.length)]
exit repeat
end if
end repeat
End
-- example:
fileName = reduceToFileName("C:\Documents and
Settings\currentUser\Desktop\web.html")
put fileName
-- "web.html"
I figured simply getting the last index of the "\" would work easier.
I
could have sworn that at one time, Tom Higgins posted one line of
MX2004
syntax to do this, and I just can't remember what it was, and that
dastardly lingo-L list yields no results. :-)
Thanks,
- Michael M.
[To remove yourself from this list, or to change to digest mode, go
to http://www.penworks.com/lingo-l.cgi To post messages to the list,
email [email protected] (Problems, email
[EMAIL PROTECTED]). Lingo-L is for learning and helping with
programming Lingo. Thanks!]
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/lingo-l.cgi To post messages to the list, email
[email protected] (Problems, email [EMAIL PROTECTED]). Lingo-L is for
learning and helping with programming Lingo. Thanks!]