AppleScript get value of a button I want to get the value of a button from an internal tool.

tell application "System Events" to tell process "App"
    set myNumberIs to get value of radio group 1 of group 1 of splitter ¬
       group 1 of window "my app" of application process "my app process"
end tell


return:

radio button " (1)" of radio group 1 of group 1 of splitter group 1 of ¬
   window "my app" 


How can I save the 1 as a value?

I tried text trimming but that didn't work. Also tried to do something like this:

if myNumberIs contains " (1)" then set myNumberIsAsInteger to 1


but then I get an error:

System Events got an error: Can’t get result of radio button \...
I tested your code with "Notifications" and found that "get value" actually returns the "AXTitle" of button "Notifications" – NOT its "AXValue".

Therefore you must code:

if title of myNumberIs contains " (1)" then set myNumberIsAsInteger to 1


This works fine with me …