Vlad_1996 Posted February 20, 2018 Posted February 20, 2018 Hello, Community. My goal is to create a script that will repeatedly hit the "scan" button in thinkorwim scanner (in case anyone's familiar with it). I will work on looping it later, because now it just doesn't work. The cursor is moving, the window becomes activated, but no clicks come through. I can't use ControlClick because I can't get control ID or anything from this button. If you have any advice at all, please do share - maybe it can be done via entirely different approach. Screenshot attached. $pos=MouseGetPos() MouseClick("left",690,310,1,0) MouseMove($pos[0],$pos[1],0) WinActivate ( "Stock Hacker Main@thinkorswim [build 1922]" )
Vlad_1996 Posted February 21, 2018 Author Posted February 21, 2018 UPD: I tried to do a simple MouseMove + MouseClick, didn't work. Works in Chrome and on desktop shortcuts. While using autoit detection tool, the whole thinkorswim window is kind of inaccessible - i.e. class, control ID, etc. don't change when I move the pointer - these fields stay empty. I also tried to activate the window and then send some Tab strokes to move the focus on the button I need, but it didn't work either - the window activates, but nothing happens. I guess the only way left is ControlClick, everyone's saying it's a great tool, but again, how do I use it if I don't have any class or control ID, only xy coordinates? Thank you MouseMove ( 981, 221 ) WinActivate ( "Stock Hacker Main@thinkorswim [build 1922]" ) MouseClick("left")
BigDaddyO Posted February 21, 2018 Posted February 21, 2018 Try hitting the Alt key on your keyboard to see if any of the buttons or options get the _ underscore below letters. if so, you can send Alt+key to do things. If the Windows Info tool can't see any controls, you may be stuck using the IUIAutomation tools. They are VERY powerful but pretty complicated.
Vlad_1996 Posted February 21, 2018 Author Posted February 21, 2018 No, the first thing I did was to check every possible option to link this button to a hotkey. Couldn't do it, and the tech support told me that it was impossible. I also tried to Tab+Tab my way to get the control focus on this button, but it didn't work either. Maybe I can do ControlClick with xy coordinates only, without controlID? I found a thread where a guy managed to do it, but that script doesn't work for me though.
Vlad_1996 Posted February 21, 2018 Author Posted February 21, 2018 UPD: just tried to test ControlClick on paint.net (to see the traces it leaves easily). At first it clicked, but the coordinates were way off (tried changing ("MouseCoordMode", didn't help. Then it stopped working, have no idea why. Then I thought why it would click if there is no control under the pointer. so I did the same thing with MS Excel using ControlClick coordinates that finder gave me. It worked! Without control ID, without class. So there must be a way to figure out the proportion between actual coordinates and ControlClick coordinates, or a way to retrieve ControlClick coordinates without finder.
Vlad_1996 Posted February 21, 2018 Author Posted February 21, 2018 UPD: got it to work in Excel, then got the ControlClick coordinates from Excel and aligned both windows so that the clicked area in Excel corresponds with the button I need to click. Didn't work((
BigDaddyO Posted February 21, 2018 Posted February 21, 2018 Sounds like you will have to read up on using that IUI Automation that I linked to above. Using the Simple Spy script will quickly tell you if it's usable for your app or not.
Vlad_1996 Posted February 21, 2018 Author Posted February 21, 2018 Bigdaddy, can you please elaborate on determining if IUI automation works for this app or not? Also, wanted to ask: what are the odds that it cannot be done by any means whatsoever? Like, not with autoit, or another scripting language or any other tool? I found MouseClickPlus function, will try this one tomorrow. They say it works in minimized windows, well, I don't need them minimized, I am even ready to running this thing on a second laptop, I just need it to click. UPD: for some reason, MouseClick doesn't seem to work well with actionable elements. I tried to select a cell in Excel with MouseMove + MouseClick, it didn't work. If you have any ideas how to use this knowledge on thinkorswim window, it'd be awesome. Thank you
Vlad_1996 Posted February 24, 2018 Author Posted February 24, 2018 Thank you very much, I got it to work.
silverbulit Posted May 6, 2018 Posted May 6, 2018 Just curious how you got it to work. I'm having same issue with another application that for some reason won't allow the window to activate. Thanks!
Earthshine Posted May 6, 2018 Posted May 6, 2018 Did you use SimpleSpy? My resources are limited. You must ask the right questions
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