Jump to content

Recommended Posts

Posted

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]" )

 

Screenshot_2.png

Posted

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")

 

Posted
  1. 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.
  2. 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.

 

Posted

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.

Posted

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. 

Posted

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((

Posted

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.

Posted

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

  • 2 months later...

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...