Re: Why is it?
Re: Why is it?
- Subject: Re: Why is it?
- From: has <email@hidden>
- Date: Fri, 20 Oct 2006 20:29:49 +0100
Mark J. Reed wrote:
set foo to {year of d, month of d as integer, day of d}
foo as text
--> "2006-10-20 7:41:26 AM"
Well, it seems the first form doesn't actually dereference the fields:
Yep. All part of AppleScript's cunning plan to support 'implicit
gets' and related trickery. It always puts off resolving literal
references as long as it can - in this case, to allow you to write
stuff like:
tell application "Finder"
{name, URL, creation date} of home
end tell
Sometime it puts it off too long, and then things don't work as
expected. In this particular case the problem is compounded by an
existing bug in AS's list-to-text coercion routine that causes it to
fail silently when an uncoerceable or otherwise awkward list item is
encountered. (Feel free to file a bug report on that: <http://
bugreport.apple.com>.)
As usual, inserting an explicit 'get' command at the point you want
your references resolved takes care of it; e.g. this also works:
(get {year of d, month of d as integer, day of d}) as text
--> "20061020"
Timothy Bates wrote:
Maybe applescript needs a new construct "with getting"
Then everything inside a "with getting"°©"end getting" pair is
coerced.
The compiler synonym could be "really"
INTERCAL is thataway, you sick, sick person --->
http://www.progsoc.uts.edu.au/~sbg/intercal/intercal2.html#2.1
has
--
http://freespace.virgin.net/hamish.sanderson/
http://appscript.sourceforge.net
http://rb-appscript.rubyforge.org
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden