Re: Excel2004, System Events & NSReceiverEvaluationScriptError
Re: Excel2004, System Events & NSReceiverEvaluationScriptError
- Subject: Re: Excel2004, System Events & NSReceiverEvaluationScriptError
- From: Larry McMunn <email@hidden>
- Date: Sat, 18 Dec 2004 16:28:53 -0500
Thanks to everyone for your help on this.
FWIW--
>At 12:01 PM -0800 12/17/04, Bill Cheeseman <email@hidden> wrote:
>
>on 2004-12-16 5:27 PM, Paul Berkowitz at email@hidden wrote:
>
>> On 12/16/04 8:16 AM, "Larry McMunn" <email@hidden> wrote:
>>
>>> keystroke "d" using command down
>>
>> What's that supposed to do anyway? Cmd-D doesn't do anything here in the
>> "Save to File" window after clicking the Save as PDF button. It's not
>> enabled in the Edit menu. You can just take that line out. I did, and it
>> works here.
>
>It selects the Desktop, if some other destination was selected in the pop-up
>when the script is run. I hadn't known that either. Learn something new
>every day!
>
Bill and Paul, I've never learned to change the default directory for saving files like this, so I learned to save them to the desktop with this and then move them to the final destination. I've really gained a lot from your contributions here, so I'm glad to pass along a little tip.
>At Fri, 17 Dec 2004 16:55:18, "Scott Babcock" <email@hidden> wrote:
>
>The best way I've found to handle this sort of issue is to wait for the target UI element to appear or vanish:
>
>----------------------------------------------------------------------
>-- loop until the referenced element appears
>on _until(uiElem)
> repeat until exists uiElem
> delay 0.1
> end repeat
>end _until
>
>-- loop until the referenced element vanishes
>on _while(uiElem)
> repeat while exists uiElem
> delay 0.1
> end repeat
>end _while
>
>...........
............
>Using the 'exists' event, you can determine whether or not your target element exists. Because elements are specified by reference instead being pointed to directly, AppleScript doesn't try to resolve them to objects and you avoid the NSReceiverEvaluationScriptError issue.
>
>The _until() and _while() handlers are pretty unsophisticated, having no mechanism to deal with the possibility that the target element never appears (or vanishes, as the case may be). They do demonstrate the concept of element verification, though.
>
>The rule is, never use a blind delay when you have a more reliable way to determine whether or not the user interface is ready for the next action.
>
Thanks so much, I'll finish these handlers up to time out after a reasonalbe time with an error message.
--
Happy Automation! :-)
Larry McMunn
President
McMunn Associates, Inc.
Specialists in automated Data Visualization through Apple products
Collingswood, NJ
(856) 858-3440
---------------------------------------------------------------
_______________________________________________
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