Le 21/06/2014 à 17:27, Thomas Fischer < email@hidden> a écrit : Hello,
from what I see on your images these are the UI elements from different windows. The English version refers to the window "Security and Privacy" of the System Preferences, while the Dutch version seems to be the UI elements for the general window of System Preferences. It refers to the window "Venster" when it should refer to the window "Beveiliging en privacy". How do you open the respective window or tell System Preferences to open it?
Best Thomas
Am 21.06.2014 um 16:14 schrieb 2551:
Friends
I'm perplexed. I have a GUI script that works 10 times out of 10 in English. A user asked me for a Dutch version.
I have translated all the relevant strings to Dutch. The script works, maybe 3 times out of 10. It always fails on the same line.
I thought at first it was a simple delay issue, but my tests show it isn't. I can do a "repeat until exists loop" on the button and it never shows up.
My tests show that when the script fails it does so because System Events fails to "see" the ui elements I need it to click.
This is what shows up in English:
https://www.dropbox.com/s/lohvw2ix76wmvaf/system events english.png
Here's a screenshot in Dutch, showing that SE has missed half of the elements (those in the red box in the above shot):
https://www.dropbox.com/s/mokg6pax8iype0p/system events dutch.png
Are there any known bugs like this with System Events or am I missing something?
Thanks for your thoughts.
I’m not sure that you really need the localized strings.
This script doesn’t use them and is able to activate the wanted anchor in the wanted prefPane
tell application "System Events" tell application "System Preferences" activate id of every pane --> {"com.apple.preference.universalaccess", "com.apple.preferences.appstore", "com.apple.preference.archiveutility", "com.apple.preferences.Bluetooth", "com.apple.preference.desktopscreeneffect", "com.apple.preference.digihub.discs", "com.apple.preference.keyboard", "com.apple.preferences.internetaccounts", "com.apple.preferences.parentalcontrols", "com.apple.preference.datetime", "com.apple.preference.startupdisk", "com.apple.preference.speech", "com.apple.preference.dock", "com.apple.preference.energysaver", "com.adobe.flashplayerpreferences", "com.apple.preference.general", "com.apple.preferences.icloud", "com.apple.preference.printfax", "com.apple.preference.ink", "com.oracle.java.JavaControlPanel", "com.apple.Localization", "com.apple.preference.expose", "com.apple.preference.displays", "com.apple.preference.notifications", "com.apple.preferences.sharing", "com.apple.preference.network", "com.blacktree.Secrets", "com.apple.preference.security", "com.apple.preference.sound", "com.apple.preference.mouse", "com.apple.preference.spotlight", "com.wacom.settingsPrefPane", "com.apple.prefs.backup", "com.apple.preference.trackpad", "com.apple.preferences.users"} # Code used to grab the anchor's names tell pane id "com.apple.preference.security" name of its anchors -->{"Privacy_TencentWeibo", "Privacy_Weibo", "Privacy_Twitter", "Firewall", "Privacy_Assistive", "Privacy_LinkedIn", "Privacy_LocationServices", "Privacy_Contacts", "Privacy_Facebook", "General", "Privacy_Diagnostics", "Advanced", "Privacy_Accessibility", "FDE", "Privacy"} end tell --reveal anchor "General" of pane id "com.apple.preference.security" # This obscure one reveals FileVault -- reveal anchor "FDE" of pane id "com.apple.preference.security" --reveal anchor "Firewall" of pane id "com.apple.preference.security"
-- reveal anchor "Privacy" of pane id "com.apple.preference.security"
reveal anchor "FDE" of pane id "com.apple.preference.security" end tell end tell
You may disable the instructions returning the id of every panes and the one returning the name of every anchors in a given pane. Here they are to show you how you may get the useful infos.
And of course, if you really want the localized window title you may use what I sent you directly by error :
localized string "CFBundleName" from table "InfoPlist" in bundle file ((path to library folder from system domain as text) & "PreferencePanes:Security.prefpane")
Yvan KOENIG (VALLAURIS, France) samedi 21 juin 2014 18:20:23
|