I want to get Watir to load a page, press a "download file" button and save the file.
This first part works fine - and the "File Download" dialog comes up --------- PART 1 ---------------- require 'Watir' include Watir ie = IE.new ie.goto("http://example.com") ie.button(:value,"Login").click ie.link(:id, "csv_link").click ------------------------------------- If I run PART 1 from the command line, it never exits, it just keeps running while the File Download dialog is up. However, if I include the autoit code (below) in the same file, it never clicks the file dialog. If I kill it the running PART I script, and then run the following: % ruby autoitFS.rb myfile where the autoitFS.rb is code like this: ----- autoitFS.rb --------------------- require 'win32ole' autoit = WIN32OLE.new("AutoItX3.Control") file = ARGV[0] autoit.WinWait("File Download") autoit.ControlClick("File Download", "Would you like to open the file or save it to your computer?", "&Save") autoit.WinWait("Save As", "Save &in", 3) autoit.ControlSetText("Save As", "Save &in", "Edit1", "E\:\\Docs\\" + file + ".csv") autoit.ControlClick("Save As", "Save &in", "&Save") -------------------------- It works... To summarize: it works if I run the scripts separately - and I Ctrl-C the first script when the dialog comes up. It doesn't work if I combine the scripts into one ruby file. How can I get this to work from within one .rb file so I can loop over a bunch of URLs? Also, how can I get the first script to exit by itself? I tried doing this from at the bottom of PART 1 system( "ruby autoitFS.rb myfile" ) but nothing happenend. Thanks, johnk -- Compare New & Used Networking Equipment http://routercomp.com _______________________________________________ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general