Re: text item delimiter
Re: text item delimiter
- Subject: Re: text item delimiter
- From: "Mark J. Reed" <email@hidden>
- Date: Fri, 29 Apr 2005 11:00:53 -0400
That won't work; even if the multiple-delimiter thing worked and the
file text were split up properly, you don't have any way of knowing
which text items had a 1 between them, which had a 2, etc; you'd
probably end up with nothing but 'a's for delimiters in the new file.
You have to do it one at a time:
set fileText to (read file ":path:to:some:file.txt")
set fromList to {"1", "2", "3", "4"}
set toList to {"a", "b", "c", "d"}
set oldDelims to AppleScript's text item delimiters
repeat with i from 1 to count fromList
set AppleScript's text item delimiters to fromList's item i
set wordList to text items of fileText
set AppleScript's text item delimiters to toList's item i
set fileText to wordList as text
end repeat
set AppleScript's text item delimiters to oldDelims
On 4/29/05, Ruby Madraswala <email@hidden> wrote:
Is this doable using text item delimiters, I tried it's not working.
All I want to do is search a text file replace all occurrence of 1 to
a, 2 to b.........................
Set FileText to read file tmptw from 1
Set Applescript's text item delimiters to {"1","2","3","4"}
Set wordlist to text items of FileText
Set Applescript's text item delimiters to {"a","b","c","d"}
Set FileText to wordlist as text
Ruby
_______________________________________________
Do not post admin requests to the list. They will be ignored.
email@hidden>
_______________________________________________
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