2

I have a simple AppleScript that works when initiated from an application that is not in full screen mode but does not work when in it's in full screen mode:

#!/usr/bin/osascript

tell application "System Events"
  set fp to (path to frontmost application) as text
end tell

tell application "Safari"
  <snip>
end tell

activate application fp

When not in full screen mode, instead of the window of the application in full screen mode getting activated, another non-full screen window in the same application is activated. How do I tell applescript to activate the original window in full screen mode?

  • I have found that an application in full screen mode temporarily "creates" its own space; you can actually toggle spaces with your usual shortcut and will find that you have one MORE space than in non-full screen mode. You must apply AppleScrip's code for changing spaces (if there is such code). – clemsam lang Nov 5 '18 at 12:04
1

Found something that works. Not sure if it's the best approach.

#!/usr/bin/osascript

tell application "iTerm2"
  set fp to name of current window
end tell


tell application "Safari"
  <snip>
end tell

tell application "iTerm2"
  activate
end tell

tell application "System Events" to tell process "iTerm2"
    click menu item fp of menu of menu bar item "Window" of menu bar 0
end tell

You must log in to answer this question.

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