Re: applescript's text item delimiters
Re: applescript's text item delimiters
- Subject: Re: applescript's text item delimiters
- From: John Stewart <email@hidden>
- Date: Wed, 27 Oct 2004 04:32:22 -0400
On 10/26/04 at -0700 donald liu said this
>Hi all,
>
>The following script script returnns "nib" instead of "foo~.nib". Is
>"~" a special character in AppleScript?
>
>
>Thanks,
>-donald
>
>
>set foo to "Macintosh
>HD:Users:dliu:Desktop:10_25:foo.app:Contents:Resources:English.lproj:
>foo~.nib"
>set AppleScript's text item delimiters to ":"
>set boo to get last word of quoted form of (foo as text)
>set AppleScript's text item delimiters to ""
>return boo
it's happening because you asked for the last word instead of the last text
item. "Word" and "text item" are not interchangable terms.
set foo to "Macintosh
HD:Users:dliu:Desktop:10_25:foo.app:Contents:Resources:English.lproj:foo~.nib"
set AppleScript's text item delimiters to ":"
set boo to get last text item of (foo as text)
set AppleScript's text item delimiters to ""
return boo
--> foo~.nib
Why did you use "quoted form of"? In this instance it causes an apostrophe
character to be added to the end of the result. Since nothing is being sent to
a shell there is no need to convert to the quoted form.
JBS
--
A clear conscience is usually the sign of a bad memory.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden