Jump to content

can't figur out the controlsend


Recommended Posts

I've made an image

Posted Image

I'm trying to puss the second button from the left

I use the line ControlSend("YENC-POWER-POST-A&A-v11b", "", "59392", "^q", 0) but it doesn't work.

In your ControlSend statement above, I believe 59392 is an integer, not a string. Try:

ControlSend("YENC-POWER-POST-A&A-v11b", "", 59392, "^q", 0)
Link to comment
Share on other sites

  • Moderators

ControlSend("YENC-POWER-POST-A&A-v11b", "", 'ToolbarWindow321', Chr(94)&Chr(113))

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

So what in the hell are you trying to do?

You're post says your trying to minimize, but the code that your trying to use says you're trying to add files to the cache'.

Which is it?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

So what in the hell are you trying to do?

You're post says your trying to minimize, but the code that your trying to use says you're trying to add files to the cache'.

Which is it?

I never said that I was trying to minimize it. I'm trying to senc ctrl+q to the program so it opens the "Add files" window but that doesn't. After that conclusion someone suggested COM/OLE Object viewer, and use COM interaction to interact with the controls. But I've been reading in the help file about that but I can't figur out how it works. So after the conclusion that controlsend doesn't work I asked if someone could give an example how to work with Com interaction and this program. With that example I hope I can figur out everything else on my owne.

Link to comment
Share on other sites

  • Moderators

For the sake of this thread ending, I downloaded the program... For those of you that have problems getting things to happen in windows, I'd suggest trying this approach:

>>>>>>>>>>>> Window Details <<<<<<<<<<<<<

Title: YENC-POWER-POST-A&A-v11b

Class: Afx:400000:b:10011:6:2a088b

Seeing this posted like this doesn't help the problem, and I'll show why in a minute. But...

1. The classname in his situation changes on every start up, is a reason it wasn't working. The last 6 digits of the Class in fact.

2. LxP has made a UDF for ClassNameNN(s) (Look in his signature) to be found that change like this, but this doesn't go up and down, it strings left to right and actually replaces some digits with others.

3. You have to be super careful on how you do things... Please note that the AutoInfo Tool can be directly copied from, this will save typing errors.

4. Sometimes sending raw characters with ControlSend() just doesn't work, make a habit of replacing them with Chr(), and it will become 2nd nature.

Dim $cz_ClassOfWindow = "Afx:400000:b:10011:6:"
_MakeWindowKnown($cz_ClassOfWindow)

Func _MakeWindowKnown($cz_ClassOfWindow)
$wz_WinList = WinList()
For $i = 0 To $wz_WinList[0][0]
    $cz_Class = _FindClassName($wz_WinList[$i][1])
    If StringLeft($cz_Class, StringLen($cz_ClassOfWindow)) = $cz_ClassOfWindow Then
        $tz_Title = WinGetTitle($wz_WinList[$i][1])
        ControlSend($tz_Title, "", "", Chr(94)&Chr(113))
    EndIf
Next
EndFunc
Func _FindClassName($hz_Handle)
    Local $rz_Return = DllCall('user32.dll', 'int', 'GetClassName', 'hwnd', $hz_Handle, 'str', '', 'int', 32768)
    If Not @error Then Return $rz_Return[2]
EndFunc
^^^^ Has been tested and DOES work.

But the funny thing is, the error was "yours", because you were messing with the title incorrectly, you didn't copy and paste the whole title.

How do I know?

ControlSend(' YENC-POWER-POST-A&A-v11b', "", "", Chr(94)&Chr(113))
^^^^ Because that also works!

There was a space in front of the "Y" should have been " Y". Now had you used Opt("WinTitleMatchMode", 2) as I believe someone suggested very early on (if not I apologies)... you would be much further in your code by now.

If this seems harsh, I apologize... But every post in this thread I've seen of yours since you've started it is "Nope" it didn't work... Not, Hey!! I even tried this and it didn't work.

But you'll leave now with a working code, I pray you're not using it for malicious reasons, but the answer was always there for anyway, just a simple human mistake you kept repeating, so you might have found it anway :lmao:.

Edit:

Quick Typo Fix (I'm sure there are others!! :P)

Edit 2:

A public apology on the Opt("WinTitleMatchMode", 2), seems no one had mentioned it:

Also one on the Minimize, seems you wanted it to work while minimized, you could do:

Dim $cz_ClassOfWindow = "Afx:400000:b:10011:6:"
_MakeWindowKnown($cz_ClassOfWindow)

Func _MakeWindowKnown($cz_ClassOfWindow)
$wz_WinList = WinList()
For $i = 0 To $wz_WinList[0][0]
    $cz_Class = _FindClassName($wz_WinList[$i][1])
    If StringLeft($cz_Class, StringLen($cz_ClassOfWindow)) = $cz_ClassOfWindow Then
        $tz_Title = WinGetTitle($wz_WinList[$i][1])
        WinSetState($tz_Title, "", @SW_MINIMIZE)
    EndIf
Next
EndFunc
Func _FindClassName($hz_Handle)
    Local $rz_Return = DllCall('user32.dll', 'int', 'GetClassName', 'hwnd', $hz_Handle, 'str', '', 'int', 32768)
    If Not @error Then Return $rz_Return[2]
EndFunc

Or

WinSetState(' YENC-POWER-POST-A&A-v11b', "", @SW_MINIMIZE)
Untested, but should work. Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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...