Sha256: 2c35a9db975eb4e662568a05c723a5a20196080fa619bd4a1b94126729f0c983

Contents?: true

Size: 1.37 KB

Versions: 1

Compression:

Stored size: 1.37 KB

Contents

require "rubygems"
begin
  require "rbosa"
rescue
  "You don't have RubyOSA. That's okay but won't be able to automatically activate Excel for screenshots."
end

def capture_xls(xls, png)
  `open #{xls}`
  sleep 2
  `screencapture #{png}`
  `mogrify -crop 840x570+14+54 #{png}`
end

# Excel should be already open, and it should be assigned to a 
# Space with nothing else in it for nice, tidy screenshots.
# Desktop background should be set to plain white, or use Backdrop.app.
# Also you should have "When switching to an application, switch to a ..." box checked
begin
  app = OSA.app("Microsoft Excel")
  app.activate
rescue
  puts "OSA activation of Microsoft Excel didn't work, you'll have to activate it manually."
end

`mkdir -p output/examples`

# Take screenshots of all Ruby Examples.
`ls content/examples/*.rb`.chomp.split("\n").each_with_index do |f, i|
  puts "processing #{f}..."

  png = f.gsub(/rb$/, "png")
  xls = f.gsub(/rb$/, "xls")

  `ruby #{f}`
  capture_xls(xls, png)
end

# Take screenshots of all Python Examples.
`ls content/examples/*.py`.chomp.split("\n").each_with_index do |f, i|
  exit # Skip processing Python examples for the moment.
  
  puts "processing #{f}..."

  png = f.gsub(/\.py$/, "-python.png")
  xls = f.gsub(/\.py$/, "-python.xls")

  `python #{f}`
  capture_xls(xls, png)
end

# Return to iTerm
begin
  app = OSA.app("iTerm")
  app.activate
rescue
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
surpass-0.0.6 webby/tasks/screenshots.rb