开发者

How to take a partial screen capture using Ruby?

开发者 https://www.devze.com 2022-12-30 02:18 出处:网络
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 progra

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
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号