Re: Curious problem with Scripter
Re: Curious problem with Scripter
- Subject: Re: Curious problem with Scripter
- From: email@hidden
- Date: Thu, 26 Apr 2001 17:26:37 -0700
>
While working on a script using Scripter PE I found that if I use the
>
auto-step feature, or if I invoke the script from the application
>
(Eudora), I get an error (variable errMessage not defined). So to
>
find where I left such variable undefined, I use the step feature of
>
Scripter, carefully pressing the shift key to be sure I step into any
>
handler that is used by the script. The funny thing is that I can
>
run the whole script that way and I never have a problem. So if I
>
run it very slowly, step by step, the variable is defined, but if I
>
go quickly with the auto-step the variable is not defined. How can
>
that be?
Well, this is a problem that does sound a bit familiar, but I'd have to see
your script to really help you.
I suggest you sign up for the Scripter Support List at the Main Event web
page and post your script there.
You may want to change the order of your script... put the handlers first,
then the top level commands. If it's already in that order, switch the
order. Also, when step debugging, open in the observe window command click
to the left the variable in question and the script will stop stepping each
time that variable's value is changed. (command-option double click your
script to get the variable name into the observe window).
>
>>I've already been raked over the coals for suggesting anything might be
wrong with or improved in Scripter so I won't go there... 8)
>
>>>Although it seems like a contradiction, relying on "power tools" does
not make one a "power user", actually it can be quite the opposite.
Now, now, people have disagreed with you. No one has "raked you over the
coals".
For example, I strongly disagree with the gist of your post here. I'd say
that using the most powerful AppleScript tools available (the debugger in
Scripter and even the debugger in latest version Script Debugger) can be a
big boost in the path to becoming a power user. But I can disagree with you
without saying mean things or grabbing my rake (or my pitchfork!)
>
>>>If the editor you're using can't handle a construct which is legal and
works in the real world, reporting an error where none should exist, it's
only natural to assume that's the final word.
If that problem was a prevalent problem that most power users would
encounter you might have a point. (Althought it has nothing to do with the
problem described here: where the Scripter behaves the same as Script
Editor and when the script is running, but the step debugging component of
the Scripter does not.) The kinds of inconsistencies you're referring are
extremely rare and are only encountered by those engaged in tangental
exercises and using the technology in undocumented and unsupported ways. I
would say there is no reasonable limitation at all.
>
>>>While in your specific case this may just be a minor annoyance, to be
sure it can be a rather discomforting feeling when a lot of time has gone
into developing a project in such a tool only to find that it doesn't work
when run outside of the comfortable little environment, at least not
without a change or two (or more).
That almost never happens. Even in this case that's not what happens. In
Scripter you run scripts without the debugging features, and it behaves
exactly like Script Editor. You also have the option of stepping through
the script a line at a time or until some predefined point while observing
variables. The process of writing scripts with Scripter involves both.
You write your script, run it. If you get an unexpected result you step
through the script until you reach the error. You open the instant window,
try alternative commands against the current context of the script until
you find one that works, you replace the broken line in the script with the
working line from the instant window and run again.
In this case a script errors when run from Scripter or from Script Editor.
It's only during the line-by-line debugging process that it doesn't
generate the error.
>
>>It seems to run scripts closest to how they will perform in the wild.
I think Script Editor is a fine tool and I know a number of Script writers
who have gone quite far with it. But I know far more power users who have
adopted Scripter or one of the other editors and won't go back. None of
them have encountered the kinds of tangental inconsistencies you referred
to.
ES