2

I am trying to create a script which lists me all available open simulators to inspect in safari developer tools but when I run the code I get the below error. At the end this script should open the inspector tool for one simulator device. My guess it that in general this is not allowed but I gave the terminal the accessibility rights so yeah I have no idea.

enter image description here

listDevices.applescript:122:168: script error: „"Simulator" of menu "Entwickler" of menu bar 1“ kann nicht gelesen werden. Zugriff nicht erlaubt. (-1723)
tell application "System Events"
    tell process "Safari"
        name of every menu item of menu item where its name starts with "Simulator" of menu "Entwickler" of menu bar 1
    end tell
end tell
2

I do not have a menu item that starts with Simulator; however, using Experimental as in Experimental Features, the following example AppleScript code did retrieve the names of the menu items on the Experimental Features menu item of the Develop menu in Safari. (My system is set to US English.)

tell application "System Events" to tell application process "Safari"
    set menuItemNames to get name of every menu item of menu 1 of ¬
        (first menu item whose name starts with "Experimental") of ¬
        menu 1 of menu bar item "Develop" of menu bar 1
end tell

return menuItemNames

So if you change "Experimental" to "Simulator" and "Develop" to "Entwickler" I'd imagine it would work for you.

| improve this answer | |
  • That is it, thank you! The Simulator menu item appears if you have a iOS Simulator running to inspect iOS Safari tabs. But is there a way to get the proper translation for "Develop"? When I want to use that script in a library for example I cannot use German here. – muuvmuuv May 13 at 9:45
  • 1
    @muuvmuuv, I do not know the answer to that, sorry. It would probably be better if you posted a separate question to address that, pointing back to this as a reference if necessary. – user3439894 May 13 at 10:29

You must log in to answer this question.

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