Sign in to follow this  
Followers 0
NisarA

using SendMessage function in Autoit

5 posts in this topic

Hi All,

I have the below requirement.

I need to click on a button in a Window, which does not have ControlID. Au3info.exe only shows up the text,class name and other details. I cannot use 'ControlClick' in this case. I tried to use 'SendMessage' function by getting the Handle of the Control but unfortunately it does not click on the ccontrol. Below is my code. I don't want to use the coordinates of the control, as i am looking for a more reliable coding. Any help would be appreciated.

Local Const $BM_CLICK=0x201

WinWait(Get_ParamValue("cap_dcs"),Get_ParamValue("cap_dcs_SL_dest"))

$hwnd = ControlGetHandle(Get_ParamValue("cap_dcs"),"","[CLASSNN:Button5; INSTANCE:5]")

If @error=0 Then

_SendMessage($hwnd,$BM_CLICK)

Else

MsgBox("0","Test","Function failed")

EndIf

Share this post


Link to post
Share on other sites



Hi All,

I have the below requirement.

I need to click on a button in a Window, which does not have ControlID. Au3info.exe only shows up the text,class name and other details. I cannot use 'ControlClick' in this case. I tried to use 'SendMessage' function by getting the Handle of the Control but unfortunately it does not click on the ccontrol. Below is my code. I don't want to use the coordinates of the control, as i am looking for a more reliable coding. Any help would be appreciated.

Local Const $BM_CLICK=0x201

WinWait(Get_ParamValue("cap_dcs"),Get_ParamValue("cap_dcs_SL_dest"))

$hwnd = ControlGetHandle(Get_ParamValue("cap_dcs"),"","[CLASSNN:Button5; INSTANCE:5]")

If @error=0 Then

_SendMessage($hwnd,$BM_CLICK)

Else

MsgBox("0","Test","Function failed")

EndIf

It might not have a control ID but it might and you think it hasn't because your code is faulty.

$hwnd = ControlGetHandle(Get_ParamValue("cap_dcs"),"","[CLASSNN:Button5; INSTANCE:5]")

should be one of

$hwnd = ControlGetHandle(Get_ParamValue("cap_dcs"),"","[CLASSNN:Button5]")

or

$hwnd = ControlGetHandle(Get_ParamValue("cap_dcs"),"","[CLASS:Button; INSTANCE:5]")

or

$hwnd = ControlGetHandle(Get_ParamValue("cap_dcs"),"","Button5")

I don't know what Get_ParamValue does so I can't say if there is a problem there, but it needs to return either the title or the handle of the window which owns Button5.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Hi,

Thanks for your reply. But neither of the below syntax works for me. the function 'Get_Paramvalue' returns the title of the window containing the button. Any other suggestions are appreciated.

Share this post


Link to post
Share on other sites

Is there any chance, we can test it own our own?


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

Hi,

Thanks for your reply. But neither of the below syntax works for me. the function 'Get_Paramvalue' returns the title of the window containing the button. Any other suggestions are appreciated.

I don't know. I should have concentrated on the fact that the window info tool doesn't show an id or a handle rather than the error in your code. I would say that a click with th emouse might be your only option.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0