• 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: Find duplicate numbers and replace
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
  • Follow-Ups:
    • RE: Find duplicate numbers and replace
      • From: "Script2" <email@hidden>
References: 
 >RE: Find duplicate numbers and replace (From: "Script2" <email@hidden>)
 >Re: Find duplicate numbers and replace (From: Ed Stockly <email@hidden>)

  • Prev by Date: Re: Find duplicate numbers and replace
  • Next by Date: Editing custom dictionary
  • Previous by thread: Re: Find duplicate numbers and replace
  • Next by thread: RE: Find duplicate numbers and replace
  • Index(es):
    • Date
    • Thread