Re: Text Manipulation
Re: Text Manipulation
- Subject: Re: Text Manipulation
- From: Robert Stretch <email@hidden>
- Date: Fri, 10 May 2002 07:18:41 +1000
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.
That's what I tried at first, then I realised that there are earlier
occurrences of "-" in the text. Can i make it find the paragraph
(line) that "Extras.rsrc" is in first and then do that? Note: The path
is one of two things, so not always the same.
Beset Wishes
Robert Stretch - Webmaster of AquaWorld
_______________________________________________
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.