Closed AuroraWright closed 6 months ago
If you are just curious, this seems to work in modern versions (perform action "AXRaise" of window winName
is the ky here!!):
def raiseWindow(self):
"""
Raises the window to top so that it is not obscured by any sibling windows.
:return: ''True'' if window raised
"""
if not self._winTitle:
return False
cmd = """on run {arg1, arg2}
set appName to arg1 as string
set winName to arg2 as string
try
activate application appName
tell application "System Events" to tell process appName
perform action "AXRaise" of window winName
end tell
end try
end run"""
proc = subprocess.Popen(['osascript', '-', self._appName, self._winTitle],
stdin=subprocess.PIPE, stdout=subprocess.PIPE, encoding='utf8')
ret, err = proc.communicate(cmd)
return not err
I'm not sure since when, but at least on Ventura 13.6.3 "tell window winName to set prevIndex to index" causes the try block to exit, causing isDone to be left to False. Just having a "tell window" seems to be enough here. On a side note, raiseWindow and lowerWindow are also broken since setting "index" doesn't seem to work anymore, but I have no idea how to fix it. isAlive being False causes issues in general so I think this should be fixed at least