• 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
International Colors
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

International Colors


  • Subject: International Colors
  • From: Luther Fuller <email@hidden>
  • Date: Sat, 05 Nov 2011 14:26:49 -0500

On Nov 5, 2011, at 10:46 AM, Robert Poland wrote, Subject: detect return, expanded:

set theColorList to {"0-none", "1-orange", "2-red", "3-yellow", "4-blue", "5-purple", "6-green", "7-gray"}
set theDefaultChoice to "0-none"

repeat while not return
set theChoice to choose from list theColorList default items theDefaultChoice with title "Color"
delay 0.5
end repeat

Why, I don't know, but it got me to thinking about internationalizing colors for a 'choose from list ...'
Here's a copy-paste-run script ...

(path to preferences from user domain)
tell application "Finder" to set labelFile to (file "com.apple.Labels.plist" of the result) as alias

try
tell application "System Events" to set colorRec to (value of property list file (labelFile as text))
set labelList to {"Unread" & tab & tab & "7", ""} -- Gray,7
set labelList to (labelList & {|Label_Name_6| of colorRec & tab & tab & "2"}) -- Red,2
set labelList to (labelList & {|Label_Name_7| of colorRec & tab & tab & "1"}) -- Orange,1
set labelList to (labelList & {|Label_Name_5| of colorRec & tab & tab & "3"}) -- Yellow,3
set labelList to (labelList & {|Label_Name_2| of colorRec & tab & tab & "6"}) -- Green,6
set labelList to (labelList & {|Label_Name_4| of colorRec & "   " & tab & tab & "4"}) -- Blue,4
set labelList to (labelList & {|Label_Name_3| of colorRec & tab & tab & "5"}) -- Purple,5
set labelList to (labelList & {"", "Outdated" & tab & "0"}) -- unlabeled,0
on error
set labelList to {"Unread" & tab & tab & "7", "", "Red   " & tab & tab & "2", "Orange" & tab & tab & "1", ¬
"Yellow" & tab & tab & "3", "Green" & tab & tab & "6", "Blue   " & tab & tab & "4", "Purple" & tab & tab & "5", "", "Outdated" & tab & "0"}
end try

tell me to choose from list the result with title "title" with prompt "Choose a label to show ..." default items {item 1 of the result} OK button name "Show"

I'm curious if this always displays color names in the users language.
In US English, the file "com.apple.Labels.plist" exists only if the user has changed the color names in Finder/Preferences.../Labels. If this is true of other languages, then this script will display the English name list as the default which is not correct for the non-english user.

What do you get when you run this in various languages?

 _______________________________________________
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: International Colors
      • From: KOENIG Yvan <email@hidden>
    • Re: International Colors
      • From: KOENIG Yvan <email@hidden>
    • Re: International Colors
      • From: Robert Poland <email@hidden>
References: 
 >detect return, expanded (From: Robert Poland <email@hidden>)

  • Prev by Date: Re: detect return, expanded
  • Next by Date: Re: International Colors
  • Previous by thread: Re: detect return, expanded
  • Next by thread: Re: International Colors
  • Index(es):
    • Date
    • Thread