i have written the following method (i know, i am a crude, vile,
wretch of a programmer) to use autoitx to change the IE proxy setting
basically it keys it's way through the menu's to the proxy setting
field and changes the port number (shortcuts are for the dutch version
of internet explorer)

it works

def autoitx_set_proxy(iex, port)
  # iex should be an instance of Watir::IE
  iex.maximize()
  localautoit = WIN32OLE.new("AutoItX3.Control")
  sleep 2
  localautoit.Send("!b")
  sleep 0.5
  (1..5).each { |n|
    localautoit.Send("{RIGHT}")
  }
  localautoit.Send("i")
  sleep 0.5
  localautoit.Send("i")
  sleep 0.5
  localautoit.Send("{ENTER}")
  sleep 0.5
  localautoit.Send("+{TAB}")
  sleep 0.5
  localautoit.Send("{UP}")
  sleep 0.5
  localautoit.Send("!l")
  sleep 0.5
  localautoit.Send("!p")
  sleep 0.5
  localautoit.Send(port.to_s)
  localautoit.Send("{TAB 3}")
  localautoit.Send("{SPACE}")
  localautoit.Send("{TAB 5}")
  localautoit.Send("{SPACE}")
end

everytime watir wants "to take over" again (with a goto method
navigating somewhere, this results in the following error

C:/Ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/ie-class.rb:
358:in `method_missing': unknown property or method
`navigate' (WIN32OLERuntimeError)
    HRESULT error code:0x80010108
      De verbindingen van het aangeroepen object met de clients zijn
verbroken.
        "ie COnnections with object and clients are disconnected"
        from C:/Ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/ie-
class.rb:358:in `goto'
        from F:/advertentieplanet.rb:82:in `newnym'
        from F:/advertentieplanet.rb:194

now this happens sometimes anyways, (when there is more than one ie
window open) but closing all windows before my script starts always
works to avoid this error.

i've had more trouble using autoitx with watir, i guess i'll just use
this method in a seperate ruby script and call that via a system call
or something

cheers, bookie

now i just run the changeproxy
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to [email protected]
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~----------~----~----~----~------~----~------~--~---

Reply via email to