Jump to content

Hyperlink doesn't work with ControlClick


Recommended Posts

ControlClick("Realtek HD Audio Manager", "", "SysLink2")

I just wanted to add some more information to this. When I run my script and simulate a click of the control "SysLink2" on the Realtek HD Audio Manager, using the line of code above, the child dialog "Device advanced settings" doesn't display. I tried ControlFocus and ControlClick on the SysLink2 control and I am not getting anywhere. I also tried WinActivate on the "Device advanced settings" dialog, but the dialog does not get displayed. I did some research in the AutoIt help and wasn't able to find anything that would solve this problem. There are ways to setup hyperlinks in the GUI reference, but I don't know of a way to get this link to function, since it is not created by GUI reference calls. I may be looking at the wrong set of calls to accomplish this. Anyone have any ideas?

Thanks in advance!

Gotta keep on truckin' to find the perfect solution, but sometimes you run into roadblocks, so you gotta jam right through those roadblocks!!

Link to comment
Share on other sites

From the help file under "Controls":

Note: AutoIt only works with standard Microsoft controls - some applications write their own custom controls which may look like a standard MS control but may resist automation. Experiment!

Try this code and see it AutoIt "sees" the control:

$Return_Value = ControlClick("Realtek HD Audio Manager", "", "SysLink2")
MsgBox(0, "$Return_Value", $Return_Value)

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

From the help file under "Controls":

Note: AutoIt only works with standard Microsoft controls - some applications write their own custom controls which may look like a standard MS control but may resist automation. Experiment!

Try this code and see it AutoIt "sees" the control:

$Return_Value = ControlClick("Realtek HD Audio Manager", "", "SysLink2")
MsgBox(0, "$Return_Value", $Return_Value)
The return value was 1 in the message box, so I assume that means true, which means that it saw the control? Is that correct?

Gotta keep on truckin' to find the perfect solution, but sometimes you run into roadblocks, so you gotta jam right through those roadblocks!!

Link to comment
Share on other sites

The return value was 1 in the message box, so I assume that means true, which means that it saw the control? Is that correct?

Yep.

And since your code does not work as expected, you might have the answer to: "does it resist automation". However, sometimes the control that shows up in the AU3Info tool is actually from another layer of the GUI.

I seem to recall a UDF somewhere that attempts to list all of the controls that it can find for a given window - sort of like WinList. Maybe sending a ControlClick to each one found would let you know if there is one that achieves the desired results.

Edited by herewasplato

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

Yep.

And since your code does not work as expected, you might have the answer to: "does it resist automation". However, sometimes the control that shows up in the AU3Info tool is actually from another layer of the GUI.

I seem to recall a UDF somewhere that attempts to list all of the controls that it can find for a given window - sort of like WinList. Maybe sending a ControlClick to each one found would let you know if there is one that achieves the desired results.

Do you happen to recall the name of the UDF so I can try to find it, or should I do a search on "list all controls"?

Gotta keep on truckin' to find the perfect solution, but sometimes you run into roadblocks, so you gotta jam right through those roadblocks!!

Link to comment
Share on other sites

Do you happen to recall ...

Have you *read* my "Custom member title": Most Senile Poster :-)

A search of the Examples subforum for the word "control" (searching title only) gave several results - look here for one of them:

http://www.autoitscript.com/forum/index.php?showtopic=32077

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

Do you happen to recall the name of the UDF so I can try to find it, or should I do a search on "list all controls"?

Look at the message above before you read this.

Do you happen to know another way to get the "Device advanced settings" dialog, which is a child of the "Realtek HD Audio Manager" dialog, to be displayed so I can set it's values?

Gotta keep on truckin' to find the perfect solution, but sometimes you run into roadblocks, so you gotta jam right through those roadblocks!!

Link to comment
Share on other sites

I don't have the app so I can only guess that there might be some keystroke combo that might open that window. You might also make the changes of interest and then see where the app stores the settings/changes that you made. Maybe in an INI file or in the registry. Maybe you write directly to that location.

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

Use WinSpy++, it has the ability which AutoIt3Info is having hard time with, to capture stacked control if this is the case here. Another approach is to use WinSpectorUI or Spy++ to log the event posted from or to the control or the GUI window and send this event or message to the destination window, most probably a fixed WM_COMMAND message.

Link to comment
Share on other sites

Use WinSpy++, it has the ability which AutoIt3Info is having hard time with, to capture stacked control if this is the case here. Another approach is to use WinSpectorUI or Spy++ to log the event posted from or to the control or the GUI window and send this event or message to the destination window, most probably a fixed WM_COMMAND message.

When I used the AutoIt v3 Window Info to get information about the control, that's where I determined that it was a SysLink. I also did a test by calling ControlFocus() to give the control the focus, and it highlighted the text, but nothing in the background around it. When I do a ControlClick on the control, which is the text, nothing happens. I also tried giving the control the focus before I did the ControlClick() and that didn't help.

Gotta keep on truckin' to find the perfect solution, but sometimes you run into roadblocks, so you gotta jam right through those roadblocks!!

Link to comment
Share on other sites

... I also did a test by calling ControlFocus() to give the control the focus, and it highlighted the text, ...

Follow that with:

ControlSend("Realtek HD Audio Manager", "", "SysLink2", "{ENTER}")

...cross your fingers...

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

Follow that with:

ControlSend("Realtek HD Audio Manager", "", "SysLink2", "{ENTER}")

...cross your fingers...

Ok, I see what you were trying to do and appreciate your suggestion, but it didn't work. Even though the focus was on the SysLink2 control using the ControlFocus() before the ControlSend(), it seemed like the dialog didn't pick up on the fact that the message with the keystroke was being sent to the SysLink2 control. Instead, it acted like the Ok button at the bottom right corner of the dialog was activated, which is also understandable to an extent.

How 'bout this, last night I was looking at the _SendMessageA(), but I couldn't figure out how to setup the LParam for the point to be clicked. It's kind of along the same line you are following, but a little different. See my code below:

#include <SendMessage.au3>;at the top of file

$WM_LBUTTONDOWN = 0X0201
$WM_LBUTTONUP = 0X0202
$MK_LBUTTON = 0X0001
$hControl = ControlGetHandle("Realtek HD Audio Manager", "", "SysLink2")
_SendMessageA($hControl, $WM_LBUTTONDOWN, $MK_LBUTTON, 0)

Is there a way to create the lParam like this in AutoIt:

LPARAM lParam = MAKELPARAM(30, 30);

The LParam or the point should be at the location where the 0 is located in the _SendMessageA() call. That's what I need to figure out now. Do you have any idea about this? If you have any other suggestions, please keep them coming. Thanks.

Edited by GrizDoug

Gotta keep on truckin' to find the perfect solution, but sometimes you run into roadblocks, so you gotta jam right through those roadblocks!!

Link to comment
Share on other sites

#include <SendMessage.au3>

Const $WM_LBUTTONDOWN = 0x0201
Const $WM_LBUTTONUP = 0x0202
Const $MK_LBUTTON = 0x0001

Run('control sysdm.cpl,,3')
WinWaitActive('System Properties')

Dim $ilParam = _WinAPI_MakeDWord(37, 14)
Dim $hWnd = ControlGetHandle('System Properties', '', 'Button2')
_SendMessage($hWnd, $WM_LBUTTONDOWN, $MK_LBUTTON, $ilParam)
_SendMessage($hWnd, $WM_LBUTTONUP, $MK_LBUTTON, $ilParam)

Link to comment
Share on other sites

#include <SendMessage.au3>

Const $WM_LBUTTONDOWN = 0x0201
Const $WM_LBUTTONUP = 0x0202
Const $MK_LBUTTON = 0x0001

Run('control sysdm.cpl,,3')
WinWaitActive('System Properties')

Dim $ilParam = _WinAPI_MakeDWord(37, 14)
Dim $hWnd = ControlGetHandle('System Properties', '', 'Button2')
_SendMessage($hWnd, $WM_LBUTTONDOWN, $MK_LBUTTON, $ilParam)
_SendMessage($hWnd, $WM_LBUTTONUP, $MK_LBUTTON, $ilParam)
That was the trick. The only other thing that was missing that someone reading this would need is to put the include at the top of the file:

#include <WinAPI.au3>

Gotta keep on truckin' to find the perfect solution, but sometimes you run into roadblocks, so you gotta jam right through those roadblocks!!

Link to comment
Share on other sites

That was the trick. The only other thing that was missing that someone reading this would need is to put the include at the top of the file:

#include <WinAPI.au3>

This is great, because I have the dialog being displayed. Now the question becomes, "How do I make the dialog (window) active?" The script stops there waiting for the window to be active. I did a test with WinActive and the dialog (window) wasn't active. It needs to be active so the script will continue. I tried WinActivate() and that didn't help. I also tried:

$hWnd = WinGetHandle("Device advanced settings")
_WinAPI_SetFocus($hWnd)

This code didn't help either. Any ideas?

Thanks in advance.

Gotta keep on truckin' to find the perfect solution, but sometimes you run into roadblocks, so you gotta jam right through those roadblocks!!

Link to comment
Share on other sites

This is great, because I have the dialog being displayed. Now the question becomes, "How do I make the dialog (window) active?" The script stops there waiting for the window to be active. I did a test with WinActive and the dialog (window) wasn't active. It needs to be active so the script will continue. I tried WinActivate() and that didn't help. I also tried:

$hWnd = WinGetHandle("Device advanced settings")
_WinAPI_SetFocus($hWnd)

This code didn't help either. Any ideas?

Thanks in advance.

I think I need to call this topic finished and start a new thread with the question above. There is a new topic with the question, "How to activate a dialog?"

Look for the topic in "General Help and Support".

Gotta keep on truckin' to find the perfect solution, but sometimes you run into roadblocks, so you gotta jam right through those roadblocks!!

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...