I am trying to navigate to security pane in system preferences using below script, if pane is already opened and minimised, script is not able to bring it front. Is there a way along with activation , I can bring it to front
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.security"
end tell
This script checks the state of the window.
If the window is visible do nothing.
tell application "System Preferences"
activate
if exists window "Security & Privacy" then
tell window "Security & Privacy" to if it is miniaturized then set miniaturized to false
else
set current pane to pane "com.apple.preference.security"
end if
end tell