How to take a partial screen capture using Ruby?
I need to run a ruby client that wakes up every 10 minutes, takes a screen-shot (ss) of a users screen, crops part of the (ss) out and use's OCR to check for a matching word....its basically a program to make sure remote employees are actually working by checking th开发者_运维知识库at they have a specific application open & the case numbers shown change.
Not sure where to even start when it comes to taking a screen-shot and cropping it, has anyone done any kind of screen capture work using Ruby?
The app will run on OSX using Ruby 1.9
Thanks!
On OS X you can use the screencapture
command in the terminal to capture the screen, so capturing the screen from Ruby shouldn't be more than
def screen_capture(path)
`screencapture #{path}`
end
精彩评论