Okay, using a program called "Notability" for taking notes now. I would like to create a shortcut for changing text colors, etc. However, I'm having trouble scripting the UI. The changing colors is not in the menu bar (otherwise it would be a piece of cake).

I'm trying to click on the color selection (see image below), but I'm getting an error. Not sure what exactly it means.

Here's the website.

Here's what I get from a window inspection tool I use:

application Process "Notability"
    window 1 Note Aug 6, 2018
        button 1
        menu button 1
        menu button "117%"
        radio group 1
            radio button 1
            radio button 2
            radio button 3
            radio button 4
            radio button 5
        checkbox 1
        checkbox 2
        button 2
        text field 1
            button 1
        scroll area 1
            outline 1
                row 1
                    UI element 1
                        static text "6"
                        static text "All Notes"
                row 2
                    UI element 1
                        static text "0"
                        static text "Unfiled Notes"
                row 3
                    UI element 1
                        static text "2018-19 Fall"
                        UI element 2
                row 4
                    UI element 1
                        static text "1"
                        static text "Education"
                row 5
                    UI element 1
                        static text "0"
                        static text "Am Pol Theory"
                row 6
                    UI element 1
                        static text "0"
                        static text "Python"
                row 7
                    UI element 1
                        static text "0"
                        static text "Astro"
                row 8
                    UI element 1
                        static text "2018-19 summer"
                        UI element 2
                row 9
                    UI element 1
                        static text "5"
                        static text "Bold"
                column 1
        menu button 3
        progress indicator 1
        button 3
        button 4
        scroll area 2
            table 1
                row 1
                    UI element 1
                        static text "5 product inclusion Aug 6, 2018"
                        static text "Today at 3:04 PM"
                        image 1
                        image 2
                row 2
                    UI element 1
                        static text "4 Tech&Culture Aug 6, 2018 (2)"
                        static text "Today at 1:59 PM"
                        image 1
                row 3
                    UI element 1
                        static text "1 Note Aug 6, 2018"
                        static text "Today at 1:37 PM"
                        image 1
                        image 2
                row 4
                    UI element 1
                        static text "2 Keynote Note Aug 6, 2018 (2)"
                        static text "Today at 1:37 PM"
                        image 1
                        image 2
                row 5
                    UI element 1
                        static text "3 Who is google Note Aug 6, 2018"
                        static text "Today at 1:37 PM"
                        image 1
                        image 2
                column 1
            scroll bar 1
                value indicator 1
                button 1
                button 2
                button 3
                button 4
        scroll area 3
            scroll bar 1
                value indicator 1
                button 1
                button 2
                button 3
                button 4
        button "1x"
        button 6
        button 7
        slider 1
            value indicator 1
        static text "58:33"
        checkbox 3
        button 8
        static text "Text Styling"
        static text "Size:"
        static text "Style:"
        static text "Lists:"
        static text "Color:"
        pop up button 1
        pop up button 2
        radio group 2
            radio button 1
            radio button 2
            radio button 3
        pop up button 3
        pop up button 4
        button 9
        button 10
        button 11
        static text "1 Note Aug 6, 2018"

Here's my accessibility inspector:

<AXApplication: “Notability”>
 <AXWindow: “5 product inclusion Aug 6, 2018”>
  <AXPopUpButton>

Attributes:
   AXEnabled:  “1”
   AXParent:  “<AXWindow: “5 product inclusion Aug 6, 2018”>”
   AXSize:  “w=51 h=27”
   AXFocused (W):  “0”
   AXChildren:  “<array of size 0>”
   AXRole:  “AXPopUpButton”
   AXTopLevelUIElement:  “<AXWindow: “5 product inclusion Aug 6, 2018”>”
   AXHelp:  “(null)”
   AXPosition:  “x=1334 y=260”
   AXValue:  “”
   AXWindow:  “<AXWindow: “5 product inclusion Aug 6, 2018”>”
   AXRoleDescription:  “pop up button”
   AXFrame:  “x=1334 y=260 w=51 h=27”

Actions:
   AXShowMenu - show menu
   AXPress - press

Here's my code so far:

tell application "System Events"
    tell process "Notability"
        tell window 1

            click "pop up button"

        end tell
    end tell
end tell

Here's the error I'm getting:

error "System Events got an error: Can’t make \"pop up button\" into type UI element." number -1700 from "pop up button" to UI element

Here's an image of the section I'm trying to script:

enter image description here

  • Notability needs to be activated before System Events can act on one of its UI Elements, e.g. add tell application "Notability" to activate and a delay 0.5 before the tell application "System Events" block. Additionally you need to be specific about which pop up button to click, you can just say click "pop up button" without saying which pop up button. – user3439894 Aug 7 at 11:41
  • Thank you! I tried to do that (I added the line you mentioned and also told it to click pop up button 1) just now and it's still giving me the same error. Any other thoughts? – Talos Potential Aug 8 at 4:37
  • I do not have Notability, so the only thing I can suggest is to use Automator to record clicking on the Color button to get the AppleScript code from the Watch Me Do action it creates. Have a look at this answer: Drag to convert Automator Action into Applescript – user3439894 Aug 8 at 12:16
  • Thanks! I already have done that for keyboard maestro. Oh well. Maybe someone else will know. Appreciate the help. – Talos Potential Aug 9 at 4:01

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.