I am trying to write an apple script that when executed, will make the currently focused window "always on top". Is this possible?
In objective-c I can do this on windows my process owns by using [NSWindow setLevel:]
but my struggle is to do it for windows my process does not own. So I am now trying to do it via apple script.
I tried this:
global frontApp, frontAppName, windowTitle
delay 3
set windowTitle to ""
tell application "System Events"
set frontApp to first application process whose frontmost is true
set frontAppName to name of frontApp
tell process frontAppName
set level of window 1 to 3
tell window 1
set windowTitle to value of attribute "AXTitle"
end tell
end tell
end tell
return {frontAppName, windowTitle}
However this gives me error -
System Events got an error: Can’t make level of window 1 of process "firefox" into type specifier.