Omegatron Posted September 29, 2015 Share Posted September 29, 2015 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 InstanceThis is the info for the OK button:Title T5Suite 2.0 informationClass WindowsForms10.Window.8.app.0.33c0d9dInstance 1Text OKMy script:Run("C:\Program Files (x86)\Dilemma\T5SuiteII\T5Suite2.0.exe")Sleep(6000)AutoItSetOption('MouseCoordMode' , 0)MouseClick('primary' , 561, 49, 1, 0)Sleep(1000)AutoItSetOption('MouseCoordMode' , 0)MouseClick('primary' , 74, 76, 1, 0)Sleep(1000)If WinExists("T5Suite 2.0 information") Then ControlSend("T5Suite 2.0 information", '', '[CLASS:Button; TEXT: OK]', '{ENTER}')EndIf Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted September 29, 2015 Moderators Share Posted September 29, 2015 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. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Omegatron Posted September 29, 2015 Author Share Posted September 29, 2015 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 informationClass: WindowsForms10.Window.8.app.0.33c0d9dPosition: 648, 479Size: 335, 324Style: 0x16C80000ExStyle: 0x00050109Handle: 0x00030EE8>>>> Control <<<<Class: WindowsForms10.Window.b.app.0.33c0d9dInstance: 1ClassnameNN: WindowsForms10.Window.b.app.0.33c0d9d1Name: Advanced (Class): [CLASS:WindowsForms10.Window.b.app.0.33c0d9d; INSTANCE:1]ID: 265972Text: OkPosition: 242, 261Size: 75, 23ControlClick Coords: 30, 12Style: 0x56010000ExStyle: 0x00000000Handle: 0x00040EF4>>>> Mouse <<<<Position: 275, 298Cursor ID: 0Color: 0xBCA16B>>>> StatusBar <<<<>>>> ToolsBar <<<<>>>> Visible Text <<<<OkFailed to open canbus connection!>>>> Hidden Text <<<< Link to comment Share on other sites More sharing options...
JohnOne Posted September 29, 2015 Share Posted September 29, 2015 TryControlClick("T5Suite 2.0 information", "", "[CLASS:WindowsForms10.Window.b.app.0.33c0d9d; INSTANCE:1]") Omegatron 1 AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Omegatron Posted September 29, 2015 Author Share Posted September 29, 2015 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 Link to comment Share on other sites More sharing options...
Omegatron Posted September 29, 2015 Author Share Posted September 29, 2015 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. Link to comment Share on other sites More sharing options...
JohnOne Posted September 29, 2015 Share Posted September 29, 2015 It depends on the structure of your script, post a reproducer. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Omegatron Posted September 29, 2015 Author Share Posted September 29, 2015 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 scriptno popup - end script Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted September 29, 2015 Moderators Share Posted September 29, 2015 It means, please post your script as it is right now, even if it is not doing exactly what you would like it to. Seeing what you're doing helps us help you "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
JohnOne Posted September 29, 2015 Share Posted September 29, 2015 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? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now