Kaeft Posted July 29, 2010 Share Posted July 29, 2010 (edited) ControlSetText($ocrselect, "", "", $image) sleep(250) ControlClick($ocrselect, "", "[CLASS:Button;TEXT:Open;INSTANCE:2]","Left",1) sleep(500) Controlsend($ocr,"","","{ALT}o{ENTER}",0) This is the first time I have ever gotten frustrated at a dumb little script... ControlClick is skipping to the next 2 lines sleep and Controlsend before actually clicking. This de-synchronizes the rest of the program. Has anyone else ever had this happen? I was originally using ControlSend to do everything, but ControlSend had some "shift" issues that I later read about. In that thread they suggested using ControlSetText instead, which unfortunately wont click the button for me. So ControlClick was the next best bet. Sequence: 1. send $image which is the location to a file to the "Open File" dialog. 2. click the open button. 3. hit alt to get to the menu bar, then O and enter to get to Options. As it is it's: 1,3,2 I often get ignored on this board. So I guess all this is in vain anyways. Edited July 30, 2010 by Kaeft Link to comment Share on other sites More sharing options...
kaotkbliss Posted July 29, 2010 Share Posted July 29, 2010 maybe a winwaitactive or a longer 2nd sleep to be sure that the window you want to interact with the menu is fully loaded and active to accept the alt O? 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy! Link to comment Share on other sites More sharing options...
Kaeft Posted July 29, 2010 Author Share Posted July 29, 2010 maybe a winwaitactive or a longer 2nd sleep to be sure that the window you want to interact with the menu is fully loaded and active to accept the alt O?I put in a winactive with a sleep to see if that would help and nothing. It seemed to take the focus away from the window rendering the control click usless. I though maybe I had mislabelled my variables, but after rechecking them I hadn't. I thought maybe that since $ocr and $ocrselect might have been too similar so I renamed all the $ocrselect to $docrselect. No luck.This is the weird part. Extending the time for the 2nd sleep makes the click sleep longer. I set the 2nd sleep from 500 to something like 200000 just to see if it really was acting funny. Sure enough the click just kept sleeping even though the 2nd sleep was after it... Idk it's strange.... I was able to get a round about solution by ControlSend(ing) an {enter}. I should open a ticket for this... but then again I am too lazy and just spent 3 hours on this. Thanks for trying kaotkbliss! I really appreciate it! Link to comment Share on other sites More sharing options...
kaotkbliss Posted July 30, 2010 Share Posted July 30, 2010 It almost sounds like the left click is sticking down and releasing the click after the 2nd sleep is finished. Maybe something like controlclick sleep(100) winwait controlsend or $dll=dllopen("user32.dll") controlclick $var=_IsPressed(01,$dll) while $var=1 $var=_IsPressed(01,$dll) sleep(10) wend controlsend (this assumes that the left mouse button is indeed sticking and will loop a sleep until it registers that the button is released) 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy! 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