Re: Find duplicate numbers and replace
Re: Find duplicate numbers and replace
- Subject: Re: Find duplicate numbers and replace
- From: Ed Stockly <email@hidden>
- Date: Thu, 15 May 2008 09:16:42 -0700
and the whole thing could be optimize, of course.
This version is a tiny bit simpler....
------------
tell application "TextEdit"
set myText to text of document 1 as text
end tell
--set myText to read (choose file)
set AppleScript's text item delimiters to "[F]"
set textList to every text item of myText
set foundItems to {}
set AppleScript's text item delimiters to ""
repeat with x from 1 to count of textList
set speedNumber to the last word of item x of textList
set foundCount to 0
repeat with y from (x + 1) to ((count of textList) - 1)
if y is not in foundItems then
set computerNumber to the last word of item y of textList
if computerNumber = speedNumber then
set the end of foundItems to y as integer
set foundCount to foundCount + 1
set appendage to item foundCount of
"abcdefghijklmnopqrstuvwxyz"
set fixLine to item y of textList
set fixLine to fixLine & appendage
set item y of textList to fixLine as text
end if
end if
end repeat
end repeat
set AppleScript's text item delimiters to "[F]"
tell application "TextEdit"
make new document at beginning
set text of document 1 to textList as text
end tell
return textList as string
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden