Re: IS: Debugging Techniques -- WAS: Re: cure for NSArgumentEvaluationScriptError?
Re: IS: Debugging Techniques -- WAS: Re: cure for NSArgumentEvaluationScriptError?
- Subject: Re: IS: Debugging Techniques -- WAS: Re: cure for NSArgumentEvaluationScriptError?
- From: Robert Poland <email@hidden>
- Date: Wed, 22 Sep 2004 17:56:57 -0600
On 04/09/21 9:30 PM, "Robert Poland" <email@hidden> wrote:
In my continuing search for the cure to NSArgumentEvaluationScriptError...
I'm trying plugging in the following.
on error errMSG
log errMSG
I had thought the log would be in the Smile Console window, wrong.
Any clues where the msg will appear?
Help understanding the use of "errMSG" would be appreciated.
Hi Bob,
I have a feeling that my similar frustrations
with dealing with intermittent transient errors
might help you here.
First of all, and I think that at least by now
you realize that 'log' commands only appear in
Smile's Console or Script Editor's Event Log
when the applications/scripts are run in those
environments. If I recall correctly, your task
is run as either a compiled script or app, and
you are getting an error dialog, but not always,
and no other clues as to reason are provided.
What I have done to deal with this is take
advantage of other OS X tools, and also employ
multiple attempts to various sections of scripts
that are more heavily divided than I would
otherwise write. This seems to deal with
transient errors pretty well; usually the kind
of error you're receiving, as Paul B. pointed
out, can occur once in a moon and can be
difficult to repeat, or it can occur once in
every three runs, but with no rhyme or reason.
Liberal use of try blocks, and optional logging
tools are the approach I would take here. Please
note that I have included four logging options,
you do not have to use all of them.
HTH
JA
Thanks for the tutorial. It appears to be over my
head for now. I did save it for future reference.
The problem was in this line,
tell application "System Events" to set
focusApp to first application process whose
frontmost is true
It errored only when the computer was asleep.
Apparently the process at that time was not
readable (as text) but did generate a non-blank
response.
The cure,
try
tell application "System Events" to set
focusApp to first application process whose
frontmost is true
on error
-- if focusApp not a valid process then leave focusApp blank
set focusApp to "" -- return to blank if not valid
end try
This coupled with the clocing statements,
try
if focusApp "" then
tell application "System Events"
to set frontmost of focusApp to true
end if
on error
-- if focusApp not a valid process then do nothing
end try
Thanks again,
--
Bob Poland - Fort Collins, CO
http://www.ibrb.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