I use Ruby to check the position of the video that I play in Quicktime through the Scripting Bridge.
For the moment, I'm just checking the position so that every nsecond:
require 'osx/cocoa'
include OSX
OSX.require_framework 'ScriptingBridge'
app = SBApplication.applicationWithBundleIdentifier_("com.apple.QuickTimePlayerX")
while true
app.documents.each do |doc|
p doc.currentTime
p doc.playing
end
wait(n_seconds)
end
This is a more intensive processor than I would like, is there a way to get the script bridge to run the Ruby block when a particular event occurs?
eg. When does a document open, close, pause / resume, etc.?
Thanks in advance!
source
share