• 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: Text Manipulation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Text Manipulation


  • Subject: Re: Text Manipulation
  • From: "Marc K. Myers" <email@hidden>
  • Date: Thu, 09 May 2002 12:03:36 -0400
  • Organization: [very little]

> Date: Thu, 9 May 2002 20:31:45 +1000
> Subject: Text Manipulation
> From: Robert Stretch <email@hidden>
> To: AppleScript List <email@hidden>
>
> Hi there,
>
> I've got a small problem with text manipulation. I have a text file
> which i am reading via:
>
> do shell script "cat <path to text file>"
> set thestring to the result
>
> The following is just a small section of the text file inside the
> variable thestring:
> "%sf -something.rsrc
> -/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HiToolbox.
> framework/Versions/A/Resources/Extras.rsrc"
> without the quotes and all on the same line if Mail cuts it up.
>
> I found the text item number that "Extras.rsrc" begins with using the
> offset command (I need this to find out which paragraph the rest of this
> is in), but how do I find out comes between the first "-" and the
> second "-"? I was thinking of using a loop which worked systematically
> backwards through each text item until it finds one with "-" in it, but
> i'm unsure of the syntax. If anybody can help it would be greatly
> appreciated!

I'd do it with AppleScript's text item delimiters:

set {od, AppleScript's text item delimiters} to [optn-L]
{AppleScript's text item delimiters, {"-"}}
try
set foundText to text item 2 of theString
on error
set foundText to ""
end try
set AppleScript's text item delimiters to od

NB: "[optn-L]" stands in for the AppleScript continuation character.

Marc K. Myers <email@hidden>
http://AppleScriptsToGo.com
4020 W.220th St.
Fairview Park, OH 44126
(440) 331-1074

[5/9/02 11:59:39 AM]
_______________________________________________
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.

  • Prev by Date: Re: OS X replacement for Script Scheduler
  • Next by Date: Re: Properties and Globals in AppleScript Studio
  • Previous by thread: Text Manipulation
  • Next by thread: Re: Text Manipulation
  • Index(es):
    • Date
    • Thread