• 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
reading a property list item
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

reading a property list item


  • Subject: reading a property list item
  • From: KOENIG Yvan <email@hidden>
  • Date: Tue, 20 May 2008 12:29:57 +0200

Hello

Trying to help a Pages users which wish to be able to insert dates in Dutch when he is using Pages in English, I wrote this piece of code trying to grab the Dutch names of day and months which are available at least in the p2Months and p2Days files.

--[SCRIPT]
set monthNames to {"JANUARY", "FEBRUARY", "MARCH", "APRIL", "MAY", "JUNE", "JULY", "AUGUST", "SEPTEMBER", "OCTOBER", "NOVEMBER", "DECEMBER"}
set dayNames to {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Faturday"}
set listeLangues to {"da", "Dutch", "English", "fi", "French", "German", "Italian", "Japanese", "ko", "no", "Spanish", "sv", "zh_CN", "zh_TW"}


set laLangue to (item 2 of listeLangues) as text

set p2l to (path to library folder from system domain) as Unicode text
set p2Months to p2l & "PreferencePanes:DateAndTime.prefPane:Contents:Resources:TimeZone.prefPa ne:Contents:Resources:" & laLangue & ".lproj:time.strings"


set p2a to path to applications folder as Unicode text
set p2Days to p2a & "iTunes.app:Contents:Resources:" & laLangue & ".lproj:Localizable.strings"


set dd to "1/12/2008"  (* French date format *)
set ladate to date dd

set dnum to day of ladate
set annee to year of ladate
set dname to (weekday of ladate) as text
repeat with i from 1 to 7
	if dname is item i of dayNames then exit repeat
end repeat
set dNameItem to "10003.00" & (i - 1)
set mName to (item (month of ladate as number) of monthNames) as text
log "dNameItem = " & dNameItem
log "mName = " & mName

tell application "System Events"
set theDayName to get value of property list item dNameItem of property list file p2Days
set theMonthName to get value of property list item mName of property list file p2Months
end tell
--[/SCRIPT]


Alas, when I run it, I get:

tell current application
path to library folder from system domain
alias "Caviar Macintosh HD:System:Library:"
path to applications folder as Unicode text
"Caviar Macintosh HD:Applications:"
(*dNameItem = 10003.001*)
(*mName = DECEMBER*)
end tell
tell application "System Events"
get value of property list item "10003.001" of property list file "Caviar Macintosh HD:Applications:iTunes.app:Contents:Resources:Dutch.lproj:Localizable.st rings"
"zondag" which is OK
get value of property list item "DECEMBER" of property list file "Caviar Macintosh HD:System:Library:PreferencePanes:DateAndTime.prefPane:Contents:Resource s:TimeZone.prefPane:Contents:Resources:Dutch.lproj:time.strings"
"Erreur dans System Events : NSReceiverEvaluationScriptError: 4"


I don't see where is the wrongdoer because I uses exactly the same syntax in both cases.

Yvan KOENIG (from FRANCE mardi 20 mai 2008 12:28:57)


_______________________________________________ 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: reading a property list item
      • From: Axel Luttgens <email@hidden>
  • Prev by Date: Re: Running a script library from within Filemaker Pro 6
  • Next by Date: Re: reading a property list item
  • Previous by thread: Re: Circle Slash on Applescript apps when copying with rsync
  • Next by thread: Re: reading a property list item
  • Index(es):
    • Date
    • Thread