i=2008+rand(2) if i>2008 puts 'in case of '+i.to_s sleep 3 require 'win32GuiTest' gui=Win32GuiTest.new gui.run('mspaint.exe') sleep 3 w=gui.findWindowLikeName('ƒyƒCƒ“ƒg').first[0] gui.setForegroundWindow(w) gui.moveWindow(w) r=gui.getWindowRect(gui.getForegroundWindow) sleep 1 3600.times do |i| rad=i*2*3.14/360.0 x=r[0]+200+100*Math.cos(rad) y=r[1]+200+100*Math.sin(rad) gui.mouseMoveAbsPix(x.to_i,y.to_i) gui.sendLButtonDown if i==0 end gui.sendLButtonUp gui.sendKeys('%f',2) gui.sendKeys('x',1) gui.sendKeys('y',1) gui.sendKeys('TestBitmap.bmp',2) gui.sendKeys('{ENTER}',2) else puts 'in case of '+i.to_s sleep 3 end