• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Scripting the Notes app
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

-- 

Bill Cheeseman - email@hidden

 _______________________________________________
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

  • Follow-Ups:
    • Re: Scripting the Notes app
      • From: 2551phil <email@hidden>
References: 
 >Re: path to script file in script's folder (From: Mitchell L Model <email@hidden>)
 >Re: path to script file in script's folder (From: Shane Stanley <email@hidden>)
 >Scripting the Notes app (From: 2551phil <email@hidden>)
 >Re: Scripting the Notes app (From: Bill Cheeseman <email@hidden>)
 >Re: Scripting the Notes app (From: 2551phil <email@hidden>)

  • Prev by Date: Re: Scripting the Notes app
  • Next by Date: Re: Scripting the Notes app
  • Previous by thread: Re: Scripting the Notes app
  • Next by thread: Re: Scripting the Notes app
  • Index(es):
    • Date
    • Thread