Gary Wright
3/29/2007 3:14:00 PM
On Mar 29, 2007, at 4:47 AM, Emil wrote:
> 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.
You can't put class blocks inside method definitions. That is why you
are getting a syntax error. Just move it to the top level and define
an alternate method to be used by sign_with_CA_two
class WIN32OLE
def slow_send(str)
send(str)
sleep 0.1
end
end
def sign_with_CA_two
@auto.slow_send("{a}")
#...
end