Jump to content

Noob: Simple OK click I cant figure out

Recommended Posts

Apologies in advance for the noob question. I'm not really familiar with the structure of the code etc having only started yesterday.


My script does the following so far, and I need it to.

Opens a program > clicks a button at a certain co-ord, clicks another, has an IfWinExists (if this certain window pops up) then click OK.

I cant get the OK button to click.

I have tried controlclick, bringing the window forward (even though it is forward), tried using just the instance, just the text, nothing worked.

I cant use mouse click because the popup window and the parent program both have the same Instance

This is the info for the OK button:

Title T5Suite 2.0 information
Class WindowsForms10.Window.8.app.0.33c0d9d
Instance 1
Text OK

My script:

Run("C:\Program Files (x86)\Dilemma\T5SuiteII\T5Suite2.0.exe")
AutoItSetOption('MouseCoordMode' , 0)
MouseClick('primary' , 561, 49, 1, 0)
AutoItSetOption('MouseCoordMode' , 0)
MouseClick('primary' , 74, 76, 1, 0)
If WinExists("T5Suite 2.0 information") Then
      ControlSend("T5Suite 2.0 information", '', '[CLASS:Button; TEXT: OK]', '{ENTER}')




Share this post

Link to post
Share on other sites

Hi, Omegatron, welcome to the forum. I am not familiar with T5suite, but the site seems to indicate it is a .NET application. Have you tried to use ControlClick on the window instead of MouseClick? Start by using the AutoIt Window Info Tool (in the same directory where you installed AutoIt) to hover over the button you are trying to click. That should give you the title and text of the window, plus the ControlID of the button. Then you would do something like this:

ControlClick("<Window Title>", "<Some text (optional)>", "<Button's Control ID>")

If you have any trouble, please post what the Window Info Tool shows you when you hover over the button, and we will do our best to assist. :)

Share this post

Link to post
Share on other sites

Hi Logan thanks for the rapid reply.

I have tried the following but no luck.  ControlClick("<T5Suite 2.0 information>", "", "<396726>")

I posted the relevant info in the OP, but here is the rest of the info anyway.

>>>> Window <<<<
Title: T5Suite 2.0 information
Class: WindowsForms10.Window.8.app.0.33c0d9d
Position: 648, 479
Size: 335, 324
Style: 0x16C80000
ExStyle: 0x00050109
Handle: 0x00030EE8

>>>> Control <<<<
Class: WindowsForms10.Window.b.app.0.33c0d9d
Instance: 1
ClassnameNN: WindowsForms10.Window.b.app.0.33c0d9d1
Advanced (Class): [CLASS:WindowsForms10.Window.b.app.0.33c0d9d; INSTANCE:1]
ID: 265972
Text: Ok
Position: 242, 261
Size: 75, 23
ControlClick Coords: 30, 12
Style: 0x56010000
ExStyle: 0x00000000
Handle: 0x00040EF4

>>>> Mouse <<<<
Position: 275, 298
Cursor ID: 0
Color: 0xBCA16B

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<
Failed to open canbus connection!

>>>> Hidden Text <<<<

Share this post

Link to post
Share on other sites

John, that's the one. Thanks!


I didn't try that because I thought that because the pop up and the parent program had the same class it would just click the 1st instance on the parent program (eg File). But now I see that because you define the window first, then the instance. Thanks again

Share this post

Link to post
Share on other sites

I'm stuck at the next stage already.


Id like my script to run 5 times, and then if I get the "T5Suite 2.0 information" pop-up for a 5th time to exit the script.

I'm not sure about exit loops. I'm finding it hard to even understand the examples, to much information for a noob like me.

Share this post

Link to post
Share on other sites

Not sure what that means but.

Open program > click > click > potential popup (50/50 it might pop up)

popup - If the popup opens then click ok and restart script, after 5 script restarts end script

no popup - end script

Share this post

Link to post
Share on other sites

All this script restarting is throwing me, you see, I have no idea what is starting your script or why it needs to restart.

Something wrong with loops?

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

  • Create New...