Ruby Autoit script to handle javascript popups
Run this code to take care of any javascript popups or security confirmations. It will always click "OK".
If you are using this as part of a script, you can include it using this structure.
require 'win32ole' begin autoit = WIN32OLE.new('AutoItX3.Control') loop do autoit.ControlClick("Microsoft Internet Explorer",'', 'OK') autoit.ControlClick("Security Information",'', '&Yes') autoit.ControlClick("Security Alert",'', '&Yes') sleep(5) end rescue Exception => e puts e end
If you are using this as part of a script, you can include it using this structure.
require 'win32/process' @pid = Process.create( :app_name => 'ruby clicker.rb', #assuming you make the above script into a file called clicker.rb :creation_flags => Process::DETACHED_PROCESS ).process_id at_exit{ Process.kill(9,@pid) }