Skip to content

Instantly share code, notes, and snippets.

@SlaunchaMan
Last active October 7, 2015 19:06
Show Gist options
  • Save SlaunchaMan/450652db0cbf061753ae to your computer and use it in GitHub Desktop.
Save SlaunchaMan/450652db0cbf061753ae to your computer and use it in GitHub Desktop.
Snap LICEcap to cover your simulator!
on min(x, y)
if x ≤ y then
return x
else
return y
end if
end min
on max(x, y)
if x ≤ y then
return y
else
return x
end if
end max
tell application "Simulator" to activate
tell application "Simulator (Watch)" to activate
tell application "System Events"
set ios_window_position to position of window 1 of process "Simulator"
set ios_window_size to size of window 1 of process "Simulator"
set watch_window_position to position of window 1 of process "Simulator (Watch)"
set watch_window_size to size of window 1 of process "Simulator (Watch)"
end tell
set ios_x to item 1 of ios_window_position
set ios_y to item 2 of ios_window_position
set ios_width to item 1 of ios_window_size
set ios_height to item 2 of ios_window_size
set ios_max_x to ios_x + ios_width
set ios_max_y to ios_y + ios_height
set watch_x to item 1 of watch_window_position
set watch_y to item 2 of watch_window_position
set watch_width to item 1 of watch_window_size
set watch_height to item 2 of watch_window_size
set watch_max_x to watch_x + watch_width
set watch_max_y to watch_y + watch_height
set _x to min(ios_x, watch_x)
set _y to min(ios_y, watch_y)
set _width to max(ios_max_x, watch_max_x) - _x
set _height to max(ios_max_y, watch_max_y) - _y
set x_margin to 8
set y_margin to 8
set height_margin to 29
set _y to _y - y_margin - 1
set _height to _height + y_margin + height_margin
set _x to _x - x_margin + 1
set _width to _width + (x_margin * 2) - 1
set window_position to {_x, _y}
set window_size to {_width, _height}
tell application "LICEcap"
activate
end tell
tell application "System Events"
set _window to window 1 of process "licecap"
set position of _window to window_position
set size of _window to window_size
end tell
tell application "Simulator" to activate
tell application "System Events"
set window_position to position of window 1 of process "Simulator"
set window_size to size of window 1 of process "Simulator"
end tell
set _x to item 1 of window_position
set _y to item 2 of window_position
set _width to item 1 of window_size
set _height to item 2 of window_size
set x_margin to 8
set y_margin to 8
set height_margin to 29
set _y to _y - y_margin - 1
set _height to _height + y_margin + height_margin
set _x to _x - x_margin + 1
set _width to _width + (x_margin * 2) - 1
set window_position to {_x, _y}
set window_size to {_width, _height}
tell application "LICEcap"
activate
end tell
tell application "System Events"
set _window to window 1 of process "licecap"
set position of _window to window_position
set size of _window to window_size
end tell
tell application "Simulator (Watch)" to activate
tell application "System Events"
set window_position to position of window 1 of process "Simulator (Watch)"
set window_size to size of window 1 of process "Simulator (Watch)"
end tell
set _x to item 1 of window_position
set _y to item 2 of window_position
set _width to item 1 of window_size
set _height to item 2 of window_size
set x_margin to 8
set y_margin to 8
set height_margin to 29
set _y to _y - y_margin - 1
set _height to _height + y_margin + height_margin
set _x to _x - x_margin + 1
set _width to _width + (x_margin * 2) - 1
set window_position to {_x, _y}
set window_size to {_width, _height}
tell application "LICEcap"
activate
end tell
tell application "System Events"
set _window to window 1 of process "licecap"
set position of _window to window_position
set size of _window to window_size
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment