GUI Scripting Notes app

Can anyone tell me how to select (any item in) the left column that lists accounts and folders in the Notes app please?


(I need to do some hacky scripting using keystrokes etc but I need to be sure that I am starting from a fixed position each time. I’ve tried using the Accessibility Inspector but, frankly, I’m lost!)

Posted on Dec 19, 2018 10:24 AM

Reply
Question marked as Top-ranking reply

Posted on Dec 20, 2018 11:46 AM

As is often the case, UI scripting is the wrong way to go about this.


Instead, try:


tell application "Notes"

show account "My account Name"

end tell


You can extend this to select specific folders:


tell application "Notes"

show account "iCloud"

show folder "My Folder"

end tell


or specific notes:


tell application "Notes"

show account "iCloud"

show note "Birthdays"

end tell

2 replies
Question marked as Top-ranking reply

Dec 20, 2018 11:46 AM in response to Arkouda

As is often the case, UI scripting is the wrong way to go about this.


Instead, try:


tell application "Notes"

show account "My account Name"

end tell


You can extend this to select specific folders:


tell application "Notes"

show account "iCloud"

show folder "My Folder"

end tell


or specific notes:


tell application "Notes"

show account "iCloud"

show note "Birthdays"

end tell

Dec 20, 2018 2:55 PM in response to Camelot

Thanks. I was aware of those options, but the problem is that the focus is unpredictable: try selecting a note in a folder or account that's not the target and then running the option to show a different account. The focus does not shift to that leftmost column but stays in the centre note column. Conversely, if one of the leftmost items (account or folder) is selected then running an option to show a specific note will retain the focus in the left column.


What I am trying to accomplish is application of a style to the note name. I can apply a style to the note body by creating it with the appropriate HTML, but I can't find a way to get HTML recognised for the note name so my intention was to use GUI scripting to apply a style from the Format menu. However, being unable to guarantee an anchor point it's difficult to 'steer' the GUI.


Actually, I did just have a small brainwave: quitting the app and relaunching seems always to get to the left column. I can then go with 'show' from there.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

GUI Scripting Notes app

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.