From: Anukul Singhal Date: 2008-07-12T20:48:13+09:00 Subject: Re: AutoIt: HWnd function of AutoIt giving method missing error Hi Siep, Thanks a lot for the reply. You are right that WinGetHandle or ControlGetHandle should do the trick for me. But my requirement is to use one of these handles to set text or do the click operation. What I want to do is this: appID = autoIt.WinGetHandle("Untitled -Notepad") autoIt.ControlSetText(appID,"","Edit1","This is a text") I want to use title argument only once to fetch the window handle and then subsequently use the window handle to perform other actions of setting text or click. Is it possible to avoid 'title' argument and use a Window Handle instead? My concern is that if there are more than 1 instance of say "Notepad", the title of all the instances of notepad would be the same but the Window Handle would be unique for each instance, and hence would be a good option to use for performing actions. Is there any way out to do the above step and avoid "title" as the first argument? Thanks, Anukul Siep Korteling wrote: > Anukul Singhal wrote: >> Hi, >> >> I am using AutoIt in my ruby code to automate a client >> application.Although most of the AutoIt methods are working fine, I am >> not able to use the HWnd function of AutoIt, getting a method missing >> error. Would like to know if there is anything wrong in the code below: >> >> require 'win32ole' >> >> autoIt = WIN32OLE.new("AutoItX3.Control") >> bb = IO.popen("C:/Windows/Notepad.exe") >> sleep 3.0 >> appID = autoIt.WinGetHandle("Untitled -Notepad") >> sAppID = appID.to_s >> appHandle = autoIt.HWnd(sAppID) >> puts appHandle > > When this line is inserted: > > puts autoIt.ole_methods > > it shows there is no method Hwnd. > > AFAIK WinGetHandle is already giving you what you want. If you need the > handle from a control (f.i. a button or label) , use ControlGetHandle. > > hth, > > Siep -- Posted via http://www.ruby-forum.com/.