Class: Snackhack2::ScreenShot

Inherits:
Object
  • Object
show all
Defined in:
lib/snackhack2/screenshots.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeScreenShot



7
8
9
10
# File 'lib/snackhack2/screenshots.rb', line 7

def initialize
  @zip = "screenshots.zip"
  @time = 60
end

Instance Attribute Details

#timeObject

Returns the value of attribute time.



4
5
6
# File 'lib/snackhack2/screenshots.rb', line 4

def time
  @time
end

#zipObject

Returns the value of attribute zip.



4
5
6
# File 'lib/snackhack2/screenshots.rb', line 4

def zip
  @zip
end

Instance Method Details

#runObject



12
13
14
15
16
17
18
19
20
21
# File 'lib/snackhack2/screenshots.rb', line 12

def run
  File.open("lol.bat", 'w+') { |file| file.write("psr.exe /start /output #{@zip} /sc 1 /gui 0") }
  File.open("lol2.bat", 'w+') { |file| file.write("psr.exe /stop") }
  Process.spawn("lol.bat")
  sleep @time.to_i
  system("lol2.bat")
  sleep 2
  File.delete("lol.bat")
  File.delete("lol2.bat")
end