Here is an edited version.
On my machine running 10.8.2 in French, it behaves flawlessly.
--[SCRIPT]
property PrintDateTimeName : ""
set PrintDateTimeName to my dateTimeStamp()
tell application "Mail"
name of window 1
end tell
my SubRoutine1(result)
set PrintDateTimeName to ""
on SubRoutine1(tempWindowName)
tell application "Mail" to activate # REQUIRED
tell application "System Events" to tell process "Mail"
try
tell window tempWindowName
--delay 0.2
keystroke "s" using {command down, shift down}
repeat until exists sheet 1
delay 0.1
end repeat
try
keystroke "d" using {command down}
end try
--delay 0.1
keystroke PrintDateTimeName
--delay 0.1
try
if value of checkbox 1 of group 1 of sheet 1 = 0 then click checkbox 1 of group 1 of sheet 1
end try
tell group 1 of sheet 1
tell pop up button 1
click
repeat
try
name of menu item 1 of menu 1
exit repeat
on error
delay 0.1
end try
end repeat
click menu item 1 of menu 1
end tell
end tell
end tell
click button 1 of sheet 1 of window 1
keystroke return
end try
end tell --tell system events
tell application "Mail"
try
close window 1 --tempWindowName
end try
end tell
end SubRoutine1
--=====
on dateTimeStamp()
return (do shell script "date -u +%Y-%m-%d" & character id 160 & "%H%M%S")
end dateTimeStamp
--=====
--[/SCRIPT]
Yvan KOENIG (VALLAURIS, France) vendredi 28 septembre 2012 17:03:58