Re: text item delimiters maddness
Re: text item delimiters maddness
- Subject: Re: text item delimiters maddness
- From: Philippe GRUCHET <email@hidden>
- Date: Tue, 4 Feb 2003 00:59:32 +0100
From: James Burns <email@hidden>
Today I have a question about how to properly extract select chunks
from a path, to truncate it to a certain length. Here's what I was
using:
set fileContents to read file sceneFile -- read chosen file
set text item delimiters to ":"
set conDir to ((words 1 thru -3 of sceneFile) as string) & ":" --
figure out content directory
... and this works fine for most files, except those that have the
underscore character in them.
Thus, a path of:
"TiBook1:Documents:jpb Projects:News24 Houston:scenes:News24in_02.lws"
becomes:
"TiBook1:Documents:jpb:Projects:News24:Houston:scenes:News24in:_:"
Any clever thoughts out there? Thanks in advance...
I'd just use:
set aPath to "TiBook1:Documents:jpb Projects:News24
Houston:scenes:News24in_02.lws"
if "_" is in aPath's last text item then
set conDir to ((aPath's words 1 thru -5) as string) & ":"
else if "_" is not in aPath's last text item then
set conDir to ((aPath's words 1 thru -3) as string) & ":"
end if
--> "TiBook1:Documents:jpb:Projects:News24:Houston:scenes:"
Kind regards,
Philippe Gruchet/SVM Mac
VNU Publications France
http://svmmac.vnunet.fr
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.