Re: Scripting the Notes app
Re: Scripting the Notes app
- Subject: Re: Scripting the Notes app
- From: Bill Cheeseman <email@hidden>
- Date: Wed, 29 Jun 2016 11:49:39 -0400
On Jun 29, 2016, at 11:24 AM, 2551phil < email@hidden> wrote:
So, AXConfirm should be the correct pick. It was, as it turned out, the first one of the three I originally tried. Still isn’t reliable, though.
Yes, AXConfirm is correct. The reason is that the search field is not a button, although in your script you named its variable 'aButton'. It is in fact a text field, and AXConfirm is equivalent to pressing return in a text field. For me, both AXConfirm and 'click' work correctly and reliably, and AXClick won't even compile.
My UI Browser product < http://pfiddlesoft.com/uibrowser/> shows that the Notes search field only responds to the AXConfirm action, while the find button within the search field only responds to the AXPress action.
I suspect that your reliability problem might stem from your use of 'launch' and 'frontmost' in combination, instead of the simpler 'activate' (or, alternatively, 'run'). Here's my version of your script, and it works reliably with either AXConfirm or 'click' on my computer.
set searchString to "change this to some text that will return a hit" activate application "Notes" tell application "System Events" tell process "Notes" set searchField to text field 1 of UI element 10 of toolbar 1 of item 1 of window 1 tell searchField set value to searchString -- perform action "AXConfirm" -- perform action "AXClick" click end tell end tell end tell
|
_______________________________________________
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