• 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: Considering case...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Considering case...


  • Subject: Re: Considering case...
  • From: "koenig.yvan" <email@hidden>
  • Date: Sat, 22 Feb 2014 21:36:06 +0100


Le 22/02/2014 à 21:24, Christopher Stone <email@hidden> a écrit :

On Feb 22, 2014, at 13:54, koenig.yvan <email@hidden> wrote:
And if the character to test is "é" or "È" your handler will respond nothing.
______________________________________________________________________

Hey David,

Yvan is right, but he doesn't give you the alternative.

id of x and character id x are the canonical way of doing things these days.

set ch1 to "é"
set ch2 to "È"

set id1 to id of ch1
set id2 to id of ch2

set char1 to character id id1
set char2 to character id id2

--
Best Regards,
Chris

Hello Christopher

Using character ID versus ASCII character isn't sufficient because we can't define a range of UPPERCASE versus a range of lowercase.

This is why I choose to rely upon a serious case converter.

Here is the compact one.property 

useASObjC_Runner : true
# true = use ASObjC Runner
# false = use python (available in the box)

my whichCase("œ")

#=====

on whichCase(aChar)
if useASObjC_Runner then
tell application "ASObjC Runner" to set maybe to modify string aChar so it is caps
else
set python_script to "import sys; print sys.argv[1].decode('utf8').upper().encode('utf8')"
set maybe to do shell script "/usr/bin/python -c " & quoted form of python_script & " " & quoted form of aChar
end if
considering case
set maybe to maybe = aChar
end considering
if maybe then
"upper"
else
"lower"
end if
display dialog "Character '" & aChar & "' is " & result & " case"
end whichCase

#=====

Graphical chars will be treated as UPPERCASE ones.


Yvan KOENIG (VALLAURIS, France) samedi 22 février 2014 21:35:13



 _______________________________________________
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: Considering case...
      • From: Christopher Stone <email@hidden>
References: 
 >Re: Considering case... (From: Steve Thompson <email@hidden>)
 >Re: Considering case... (From: "koenig.yvan" <email@hidden>)
 >Re: Considering case... (From: Christopher Stone <email@hidden>)

  • Prev by Date: Re: Considering case...
  • Next by Date: Re: Considering case...
  • Previous by thread: Re: Considering case...
  • Next by thread: Re: Considering case...
  • Index(es):
    • Date
    • Thread