Jump to content

Help me with controlclick


 Share

Recommended Posts

You don't need to WinActivate windows before you ControlClick them... That's the nice thing about ControlClick?

Example:

Run ("notepad")
WinWait ("Untitled -")
Run ("control Sysdm.cpl")
WinWait ("System Properties")

MsgBox (0, "", "We're going to activate Notepad and controlclick OK on the System Properties window while it's not active.")
WinActivate ("Untitled - ")
Sleep (2000)
ControlClick ("System Properties", "", "OK")
Link to comment
Share on other sites

You don't need to WinActivate windows before you ControlClick them... That's the nice thing about ControlClick?

Example:

Run ("notepad")
WinWait ("Untitled -")
Run ("control Sysdm.cpl")
WinWait ("System Properties")

MsgBox (0, "", "We're going to activate Notepad and controlclick OK on the System Properties window while it's not active.")
WinActivate ("Untitled - ")
Sleep (2000)
ControlClick ("System Properties", "", "OK")

I dont understand!! Help me plz.
Link to comment
Share on other sites

Controlclick has the ability to click the window even the window is not active. But not all.

from the helpfile:

Remarks

Some controls will resist clicking unless they are the active window. Use the WinActivate() function to force the control's window to the top before using ControlClick().

If the your controlclick clicking on a button, try to use Controlcommand.

ControlCommand("System Properties", "", "CONTROL ID", "Check", "")

Use the AutoIt window info to get the CONTROL ID of the button.

Edited by nfaustin
[font="Palatino Linotype"][size="2"]*** The information contained in this post should be considered and certified WORKS ON MY MACHINE ***[/size][/font][font="Palatino Linotype"][size="2"] [/size][/font]
Link to comment
Share on other sites

Control Click is like clicking, but that window doesn't have to be active.

The ControlClick function takes 3 mandatory parameters:

Title of the window

Text

Control ID

What Exodius is doing is:

ControlClick ("System Properties", "", "OK")

He first tells AutoIT to click on the window with the title "System Properties". For text he makes the parameter null. He finishes by telling AutoIT to click the button that is labeled "OK". This means that even though Notepad is active, it selects the System Properties window and hits the OK button.

-Pandemic

Edited by Pandemic
Link to comment
Share on other sites

He first tells AutoIT to click on the window with the title "System Properties". For text he makes the parameter null. He finishes by telling AutoIT to click the button that is labeled "OK". This means that even though Notepad is active, it selects the System Properties window and hits the OK button.

Quoted for truth, basically I'm opening two windows (that anyone running Windows XP at least) should be able to open by default, activating one and then showing that you can ControlClick on the other window (the System Properties window) which is inactive.

So if it's not working for you taren9k3, then you may have some fundamental issues on your machine. :)

Edited by exodius
Link to comment
Share on other sites

Do you need to actually click on the x? As in WinClose won't work?

Yes. The application is a download manager. afaik there's no option to have it start to tray. I'm launching with an app that launches the browser with it, and kills the download manager when the browser closes. If you click the 'x' it minimizes to tray. But I see no way to do it. A sendmessage to the system menu may work if I can dig out how to do it again. But it would be nice if I could just mouse click the 'x' since some apps do owner draw in the frame and sysmenu close may not work with those.

edit: if I send it a 'close' it will shut down instead of hide to tray. If I send it a 'min' then it will show the task bar button. So click on 'x' would be best if it were possible.

Edited by MilesAhead
Link to comment
Share on other sites

_WinAPI_SetWindowPlacement may do what you need but you will have to know what command to put in the WINDOWPLACEMENT Structure ($tagWINDOWPLACEMENT).

Get a handle to window, press the X button then call _WinAPI_GetWindowPlacement to find out what the tagWINDOWPLACEMENT->showCmd is.

Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]

Link to comment
Share on other sites

Someone can make the program that can login to Yahoo without activate Yahoo messenger window.

eh?

Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]

Link to comment
Share on other sites

I think he need rentacoder

Heh. Or he can try http://www.DonationCoder.com in the "Coding Snacks" forum. That's how I ended up doing this one. The minimize to tray thing I'm just doing for myself. Since I wrote the program to launch browser with download manager I figured I might as well use it myself. :)

Edited by MilesAhead
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...