2

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 \...
  • 1
    Your first code snippet does not compile as the tell application block is not closed. Can you paste the rest of the code ? Right now, I'm confused how the value of a radio group object can return a radio button object. This implies to me that either the code is incomplete, or I'm too tired to compute what's actually happening. – CJK Sep 22 '18 at 18:39
1

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 …

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .