Re: tell or not to tell
Re: tell or not to tell
- Subject: Re: tell or not to tell
- From: Christopher Nebel <email@hidden>
- Date: Thu, 10 Jan 2008 01:00:13 -0800
The problem is that "month" is also defined as a class, so merely
saying "month" is ambigious -- did you mean the class or the property?
-- and AppleScript assumes you meant the class, which unfortunately
you didn't. If you qualify it by saying "its month" (obviously,
"month of it" would work as well), it will work as you desire.
--Chris Nebel
AppleScript Engineering
On Jan 10, 2008, at 12:35 AM, Skeeve wrote:
can someone tell me why "tell" does not work here?
Working handler:
on last_weekday(a_weekday, the_date)
copy the_date to a_date
set day of a_date to 1
if month of a_date as integer is 12 then
set month of a_date to 1
set year of a_date to (year of a_date) + 1
else
set month of a_date to (month of a_date) + 1
end if
set a_date to a_date + (((7 + a_weekday - (weekday of a_date) as
integer) mod 7) - 7) * days
return a_date
end last_weekday
Can be called with
display dialog "Last " & last_weekday(Monday, current date)
to find the last Monday of the given month.
I wanted to save some of the "of a_date"s above so thought this
should work, but it didn't even compile:
on last_weekday(a_weekday, the_date)
copy the_date to a_date
tell a_date
set day to 1
if month as integer is 12 then
set month to 1
set year to year + 1
else
set month to month as integer + 1
end if
end tell
set a_date to a_date + (((7 + a_weekday - (weekday of a_date) as
integer) mod 7) - 7) * days
return a_date
end last_weekday
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (applescript-
email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden
_______________________________________________
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