Skip to content

Instantly share code, notes, and snippets.

@oleksii-zavrazhnyi
Created December 22, 2014 05:15
Show Gist options
  • Save oleksii-zavrazhnyi/1a264bc84f100e756035 to your computer and use it in GitHub Desktop.
Save oleksii-zavrazhnyi/1a264bc84f100e756035 to your computer and use it in GitHub Desktop.
Rotate Movies (Ham)
on appIsRunning(appName)
tell application "System Events" to (name of processes) contains appName
end appIsRunning
if appIsRunning("QuickTime Player") then
tell application "QuickTime Player"
delay 1
try
close document 1 saving no
end try
delay 1
quit
end tell
delay 1
end if
tell application "QuickTime Player"
activate
delay 1
try
open ("/Users/" & short user name of (system info) & "/Desktop/Movies/" & weekday of (current date) & ".mov" as POSIX file)
delay 1
activate
set movie_loaded to true
end try
end tell
delay 1
if movie_loaded then
tell application "System Events" to keystroke "r" using {command down, shift down}
delay 1
tell application "QuickTime Player" to activate
tell application "System Events" to tell process "QuickTime Player"
tell window 1
set {x, y} to get position
end tell
set moved_by_script to false
if x < 2560 then
if y = 0 then
key code 3 using command down
set moved_by_script to true
end if
tell window 1 to set position to {x + 2560, y}
end if
if y > 0 or moved_by_script then
key code 3 using command down
end if
end tell
delay 1
tell application "QuickTime Player"
set presenting of document 1 to true
set looping of document 1 to true
play document 1
end tell
end if
# EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment