Guest User

Untitled

a guest
Jul 17th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. # just ignore width and height variables
  2. width, height, bmp = Win32::Screenshot.foreground
  3. File.open("c:/images/foreground.bmp", "wb") {|io| io.write(bmp)}
  4.  
  5. # ignore them even more by using special variable names
  6. _, _, bmp = Win32::Screenshot.foreground
  7. File.open("c:/images/foreground.bmp", "wb") {|io| io.write(bmp)}
  8.  
  9. # just use the Array#[] with index
  10. result = Win32::Screenshot.foreground
  11. File.open("c:/images/foreground.bmp", "wb") {|io| io.write(result[2])}
  12.  
  13. # or use the Array#last method
  14. result = Win32::Screenshot.foreground
  15. File.open("c:/images/foreground.bmp", "wb") {|io| io.write(result.last)}
Add Comment
Please, Sign In to add comment