From: H- 16 on
I know for a fact that one can use AutoIt in Rubybut I don't know ho to
do it or how to even use it inside Ruby.

Has anyone actually done this?
--
Posted via http://www.ruby-forum.com/.

From: Marvin Gülker on
H- 16 wrote:
> I know for a fact that one can use AutoIt in Rubybut I don't know ho to
> do it or how to even use it inside Ruby.
>
> Has anyone actually done this?

I once wrote a library for exactly that purpose, but until today I
didn't get much feedback. So, if you want to give it a try:
http://rubygems.org/gems/au3

Otherwise, stick to win32ole:
require "win32ole"
au3 = WIN32OLE.new("AutoItX3.Control")

Marvin
--
Posted via http://www.ruby-forum.com/.

From: James Britt on
Marvin G�lker wrote:

>
> Otherwise, stick to win32ole:
> require "win32ole"
> au3 = WIN32OLE.new("AutoItX3.Control")


That's how I've used it. It's pretty straightforward.

I typically ended up writing a few helper methods for some of the
repetitive things that required sending multiple commands to autoitx, or
just to make the main code cleaner.



#---- example: sign in to library Web site ---
require 'win32ole'

def set_up
@au3 = WIN32OLE.new "AutoItX3.Control"
@au3.opt "WinTextMatchMode", 2
end

# Yeah, it's kinda old ...
def browse_to url
@au3.Run "C:\\Program Files\\Mozilla Firefox2\\firefox.exe #{url}"
end

def enter
@au3.Send "{ENTER}"
end

def tab
send "{TAB}"
end


def wait n
@au3.Sleep n.to_i
end

def send s
warn s
@au3.Send s.to_s
end

def wait_for_title t
@au3.WinWaitActive t.to_s
end

#---------------

cardnumber = '9670150903536'
pin = '90873'
set_up
browse_to 'http://libcat.scottsdaleaz.gov/patroninfo'
wait_for_title "Millennium Web Catalog"

# Make sure whole page has loaded over flakey WiFi
sleep 4

send cardnumber
tab
send pin
enter


#---------------


It's also handy to learn about the Windows message queue and sending
commands there. It makes it easier/more reliable to trigger actions
using, say, accelerator commands or keyboard shortcuts (e.g. ctrl+v)
instead of mouse clicks or menu navigation.

I had some code that hooked into Watir and took screenshots of each
page, pasted them into Paintbrush, then saved them to disk, but at the
moment I have no idea where that code is. But sending raw key messages
made it pretty easy to do.

http://www.autoitscript.com/autoit3/docs/appendix/WinMsgCodes.htm



--
James Britt

www.jamesbritt.com - Playing with Better Toys
www.ruby-doc.org - Ruby Help & Documentation
www.rubystuff.com - The Ruby Store for Ruby Stuff
www.neurogami.com - Smart application development

From: H- 16 on
Marvin Gülker wrote:
> H- 16 wrote:
>> I know for a fact that one can use AutoIt in Rubybut I don't know ho to
>> do it or how to even use it inside Ruby.
>>
>> Has anyone actually done this?
>
> I once wrote a library for exactly that purpose, but until today I
> didn't get much feedback. So, if you want to give it a try:
> http://rubygems.org/gems/au3
>
> Otherwise, stick to win32ole:
> require "win32ole"
> au3 = WIN32OLE.new("AutoItX3.Control")
>
> Marvin

Thanks, I didn't know you needed the '.Control'.

I tried installing your gem but I need v. 1.9

I'm on a windows platform so now the question is how do I upgrade?
--
Posted via http://www.ruby-forum.com/.

From: Marvin Gülker on
H- 16 wrote:
> I'm on a windows platform so now the question is how do I upgrade?

http://www.rubyinstaller.org/

Marvin
--
Posted via http://www.ruby-forum.com/.