RE: Find duplicate numbers and replace
RE: Find duplicate numbers and replace
- Subject: RE: Find duplicate numbers and replace
- From: "Script2" <email@hidden>
- Date: Thu, 15 May 2008 15:15:16 -0400
- Importance: Normal
Thanks, Ed.
-----Original Message-----
From: Ed Stockly [mailto:email@hidden]
Sent: Thursday, May 15, 2008 12:17 PM
To: liste AppleScript US
Cc: Script2
Subject: Re: Find duplicate numbers and replace
> 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