• 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: Sorting characters of the text - script doesn't work as expected
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Sorting characters of the text - script doesn't work as expected


  • Subject: Re: Sorting characters of the text - script doesn't work as expected
  • From: Yvan KOENIG <email@hidden>
  • Date: Mon, 17 Apr 2017 19:17:56 +0200

Try :

tell application "TextEdit"
activate
set p2d to path to desktop as text
set theFile to p2d & "TXT.txt"
set theDoc to open file theFile
set MyDoc to text of theDoc
end tell
set everyCharacters to text items of MyDoc

# Build a list containing one occurrence of every characters available in the document
set uniqueCharacters to {}
repeat with aChar in everyCharacters
if aChar is not in uniqueCharacters then copy aChar as text to end of uniqueCharacters
end repeat

# Build a list of greek characters available in the document
set GreekYes to {}
repeat with aGreek in {"α", "β", "γ", "δ", "ε", "ζ", "η", "θ", "ι", "κ", "λ", "μ", "ν", "ξ", "ό", "о", "π", "ρ", "ς", "Ύ", "φ", "χ", "ψ", "ω"}
if aGreek is in uniqueCharacters then
copy (aGreek as text) to end of GreekYes
end if
end repeat

# Build a list of non greek characters available in the document
set GreekNo to {}
repeat with noGreek in uniqueCharacters
if noGreek is not in {space, " ", "(", ")", "-", "+", "=", "|", "{", "}", "°", "[", "]", "^", "/", "·", "$", "€", "‡", "±", "*", "<", ">", "≥", "≤", "≠", ":", ";", ".", ",", "⁄", "‹", "›", "—", "_", "?", "!", "«", "»", "", linefeed, tab, "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "\\"} then
copy (noGreek as text) to end of GreekNo
end if
end repeat

{GreekYes, count GreekYes, linefeed, GreekNo, count GreekNo}


Yvan KOENIG running Sierra 10.12.4 in French (VALLAURIS, France) lundi 17 avril 2017 19:13:26



 _______________________________________________
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: Sorting characters of the text - script doesn't work as expected
      • From: ILJA SHEBALIN <email@hidden>
References: 
 >Sorting characters of the text - script doesn't work as expected (From: ILJA SHEBALIN <email@hidden>)
 >Re: Sorting characters of the text - script doesn't work as expected (From: Christopher Stone <email@hidden>)
 >Re: Sorting characters of the text - script doesn't work as expected (From: ILJA SHEBALIN <email@hidden>)

  • Prev by Date: Re: Sorting characters of the text - script doesn't work as expected
  • Next by Date: Re: Dash search ?
  • Previous by thread: Re: Sorting characters of the text - script doesn't work as expected
  • Next by thread: Re: Sorting characters of the text - script doesn't work as expected
  • Index(es):
    • Date
    • Thread