Skip to content

Instantly share code, notes, and snippets.

@allfro
Created June 12, 2014 00:29
Show Gist options
  • Save allfro/a7aa1a0e937ce49dd56c to your computer and use it in GitHub Desktop.
Save allfro/a7aa1a0e937ce49dd56c to your computer and use it in GitHub Desktop.
Bring all out of bounds Mac windows back in bounds
on run {input, parameters}
tell application "Finder"
set _bounds to get bounds of window of desktop
end tell
tell application "System Events"
set ids to (unix id of processes whose name is equal to "java")
repeat with _id in ids
tell (first process whose unix id is equal to _id)
repeat with _window from 1 to (count windows)
tell window _window
if (get first item of (get position)) is less than 0 or (get second item of (get position)) is less than 0 then
-- set size to {get third item of _bounds, get fourth item of _bounds}
set position to {get first item of _bounds, get (second item of _bounds) + 22}
end if
end tell
end repeat
end tell
end repeat
end tell
return input
end run
@allfro
Copy link
Author

allfro commented Jun 12, 2014

This was created in Automator as an applescript workflow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment