Re: Can someone explain this?
Re: Can someone explain this?
As previously noted, the only documented exception for the non-
optionality of 'the' is 'the clipboard' and all other documented
usage is optional. All in all, I think it would be better if 'the
clipboard' migrated to 'pasteboard' and 'the' is always optional.
Then there will be zero exceptions to remember and more time to
concentrate on the scripting task at hand.
That is not accurate. The "the" is optional. The command works just
fine without it, it is not required, so it is optional. The issue is
that using it changes the behavior of the command in an unexpected
way. There are many cases where inserting the word "the" will
interfere with a command.
choose file
choose the file
One compiles and one doesn't. This case is very much the same. "end
of [a list]" is the command used to get the value of the last item of
the list, but in Michelle's script she was using it to provide an
index for the last item. It's kind of cool it works that way at all
and when it doesn't work it's usually pretty clear, but if the list is
formatted this way:
set myList to {"a", "b", "c", pi as text, 3}
items 1 through the end of myList
The command compiles and runs without an error but provides an
incorrect result. So, in my book, that makes it a bug.
The work around is to use "-1" rather than 'the end" for index. For
example:
This syntax:
items 2 through last item of myList
Compiles as this:
items 2 through -1 of myList
But this syntax:
items 2 through the last item of myList
Compiles as is, but has the same behavior at runtime as Michelle's
version.
ES
_______________________________________________
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