set todayStart to (current date)
-- Try # 1
set {hours, minutes, seconds} of todayStart to {0, 0, 0}
-- Gets a forbidden message (Tiger)
-- Try #2
tell todayStart to set {hours, minutes, seconds} to {0, 0, 0}
-- Has no effect at all
-- Try #3
set hours of todayStart to 0
set minutes of todayStart to 0
set seconds of todayStart to 0
-- works as expected
todayStart
I was shooting for lazy, John, hoping that {hours, minutes, seconds} of todayStart would compile into {hours of todayStart, minutes of todayStart, seconds of todayStart}
Yes. ‘Hours’ and ‘minutes’ are already defined as AppleScript constants and ‘seconds’ has a meaning in ‘with timeout’ blocks. You have to ensure that the compiler knows you mean the new properties of date objects. Another version of John’s suggestion would be:
tell todayStart to set {its hours, its minutes, its seconds} to {0, 0, 0}
Better still, in this case, use ‘time’, which is both faster and compatible with pre-Tiger systems: