action perform in the other program by ruby program
As far as I understand you want to interact with Win32 GUI application.
Try to use Windows messages to get data and perform actions on its GUI
controls (text area, buttons).
All you need is:
Find the program window (== get it’s handle) by title
Find the GUI control you want to work with (== get it’s handle)
Send message to this control (for example - to get text from text box
you need something like WM_GETTEXT message (see MSDN for details), to
push a button WM_LBUTTONDOWN,…)
For step 1, 2 I cannot remember Win API functions by name, but you
shouldn’t have any problems finding one (See MSDN, section about Window
functions).
It’s very brief explanation. If you have more specific question - feel
free to ask.
Find the program window (== get it’s handle) by title
Find the GUI control you want to work with (== get it’s handle)
Send message to this control (for example - to get text from text box
you need something like WM_GETTEXT message (see MSDN for details), to
push a button WM_LBUTTONDOWN,…)
For step 1, 2 I cannot remember Win API functions by name, but you
shouldn’t have any problems finding one (See MSDN, section about Window
functions).
It’s very brief explanation. If you have more specific question - feel
free to ask.
This should be the function to find the window handle:
For this I also need the name of the class, but I have installed a tool
that can show me that.
I couldn’t find a function on MSDN to find a controls handle, so I’m
kinda stuck on this one. Please help me out here.
I’ve actually looked a bit into autoit for ruby and it solved most of my
problems, but maybe this will come in handy if I have any trouble with
autoit.
My biggest problem right now is that the program I want to automate is
using some web based elements, which means that there is some text I
cant seem to get from the program. I’m considering using some kind of
screenscrape to regonize the text I need, if such solution is available
(or even nessecary).
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.