On Mar 29, 4:47 am, Emil <esan... / gmail.com> wrote:
> Hi, I have a little problem which I don't think shouldn't be to
> difficult to solve.
>
> I run two different methods. In one of the methods I want to override a
> class, but not in the other one.
>
> I want to do something like this:
>
> @auto = WIN32OLE.new("AutoItX3.Control")
>
> def sign_with_CA_one
>     @auto.Send("{a}")
>     @auto.Send("{b}")
>     @auto.Send("{1}")
>     @auto.Send("{2}")
> end
>
> def sign_with_CA_two
>     class WIN32OLE
>       alias oldSend(str) Send(str)
>       def Send(str)
>         oldSend(str)
>         sleep 0.1
>       end
>     end
>     @auto.Send("{a}")
>     @auto.Send("{b}")
>     @auto.Send("{1}")
>     @auto.Send("{2}")
> end
>
> In short: When using one of the methods I want to add a little sleep
> after each character sendt, but not in the other one. But the code above
> gives syntax error.
>
> Any ideas?
> Regards
> Emil
>
> --
> Posted viahttp://www.ruby-forum.com/.

Send is not a method of WIN32OLE.  WIN32OLE is delegating to the OLE
object, AutoIt in this case.
I suspect you have to write a wrapper instead of aliasing, but maybe
someone with more OLE
experience can provide a better solution

Cheers
Chris