• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: applescript's text item delimiters
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >applescript's text item delimiters (From: donald liu <email@hidden>)

  • Prev by Date: Re: Dice
  • Next by Date: Re: Applescript, VectorScript & VectorWorks
  • Previous by thread: Re: applescript's text item delimiters
  • Next by thread: Open Files for Illustrator
  • Index(es):
    • Date
    • Thread