Rép: reading a property list item
Rép: reading a property list item
- Subject: Rép: reading a property list item
- From: KOENIG Yvan <email@hidden>
- Date: Tue, 20 May 2008 16:56:44 +0200
Le 20 mai 2008 à 14:26, KOENIG Yvan a écrit :
Oops,
In the Pages templates some months are missing so I will return to
DateAndTime ;-)
--[SCRIPT]
set dd to "1/12/2008"
set ladate to my traduitLaDate(dd, 6)
on traduitLaDate(d, l)
local nomsDesMois, nomsDesJours, ladate, numJour, annee, nomJour,
itemNomJour, itemNomMois, laLangue, p2a, nomDuJour, nomDuMois
set nomsDesMois to {"JANUARY", "FEBRUARY", "MARCH", "APRIL", "MAY",
"JUNE", "JULY", "AUGUST", "SEPTEMBER", "OCTOBER", "NOVEMBER",
"DECEMBER"}
set nomsDesJours to {"Sunday", "Monday", "Tuesday", "Wednesday",
"Thursday", "Friday", "Saturday"}
try
set ladate to date d
on error
return d as text
end try
set numJour to day of ladate
set annee to year of ladate
set nomJour to (weekday of ladate) as text
repeat with i from 1 to 7
if nomJour is item i of nomsDesJours then exit repeat
end repeat
set itemNomJour to "10003.00" & (i - 1)
set itemNomMois to (item (month of ladate as number) of nomsDesMois)
as text
set laLangue to (item l of {"da", "Dutch", "English", "fi",
"French", "German", "Italian", "Japanese", "ko", "no", "Spanish",
"sv", "zh_CN", "zh_TW"}) as text
set p2a to path to applications folder as Unicode text
set p2l to (path to library folder from system domain) as Unicode text
tell application "System Events"
try
set nomDuJour to get value of property list item itemNomJour of
property list file (p2a & "iTunes.app:Contents:Resources:" & laLangue
& ".lproj:Localizable.strings")
set nomDuMois to get value of property list item itemNomMois of
property list file (p2l &
"PreferencePanes:DateAndTime.prefPane:Contents:Resources:TimeZone.prefPa
ne:Contents:Resources:" & laLangue & ".lproj:time.strings")
on error
return d as text
end try
end tell
return (nomDuJour & ", " & numJour & " " & nomDuMois & " " & annee)
as text
end traduitLaDate
--[/SCRIPT]
Yvan KOENIG (from FRANCE mardi 20 mai 2008 16:56:28)
_______________________________________________
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