Re: Tell Blocks Considered Harmful (was Re: open for access)
Re: Tell Blocks Considered Harmful (was Re: open for access)
- Subject: Re: Tell Blocks Considered Harmful (was Re: open for access)
- From: Shane Stanley <email@hidden>
- Date: Thu, 18 Dec 2008 18:14:12 +1100
- Thread-topic: Tell Blocks Considered Harmful (was Re: open for access)
On 18/12/08 4:19 PM, "Chris Page" <email@hidden> wrote:
> My definition of ³work² is that it works in as many situations as
> possible and is not likely to break when I run it on another computer
> or after a software update, and that I never have to change it.
So you never script Finder, System Events, Mail or in AppleScript Studio.
Seriously, I've had lots of scripts break over the years, and in the
majority of cases it's because of either bugs in applications or changes
that just couldn't be anticipated.
In fact, by your definition of work, anyone who uses the Finder rather than
do shell script to do file management is not writing "working" scripts,
given the combination of Finder scripting's dreadful history, combined with
what's happened with almost every other app that's gone from Carbon to
Cocoa. (And yes, by and large that's what I'm doing with the Finder myself.)
The truth is that scripters live in an uncertain world. We're at the mercy
of OS programmers, app programmers, and often product management types who'd
just love us to disappear and remove one more development cost. We can worry
about how long our scripts will last, and possibly drive ourselves to the
grave before they break, or solve today's problems today.
> I've offered to you some simple suggestions for making scripts more
> likely to work in more situations for a longer amount of time.
Great. But you're also asking about a fundamental change in behavior that
will guarantee that people's scripts will fail in more situations.
> Things Change. One of my favorite movies.
I'm all for change -- but only for the better, not for its own sake. One of
the reasons lots of people had scripts that kept working for revision after
revision of the OS was, ironically, because for a long time AppleScript
didn't change much.
> No, I'm suggesting that if you write cleaner scripts that have fewer
> incidental, unintended dependencies, it makes it easier for script,
> addition and application developers to figure out what they need to
> remain compatible with and what they don't.
I'm not sure I follow. I'm answering the question you keep asking, of
whether we need dialogs to be modal in the apps we aim them at as opposed to
run them from, and I keep saying yes, we do. I'm not disputing that we
should aim for the best coding practice -- but that's only indirectly
related to the issue with dialogs.
>
> I am asking all these questions because I cannot, just by looking at
> scripts with large tell blocks, be certain of what the author intended.
OK, but I think you've received a pretty comprehensive answer from people
here, which can be summarised as: for dialogs, they often aim them at apps
to stop the user from making changes, and with other scripting addition
commands they do it for perceived convenience.
--
Shane Stanley <email@hidden>
AppleScript Pro Florida, April 2009 <http://scriptingmatters.com/aspro>
_______________________________________________
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