Jump to content

Recommended Posts

Posted

Hello,

I want to use AutoIt scripts to move my mouse around my workspace and perform subsequent operations - keysend combinations etc - in windows belonging to a 3rd-party application (Ninjatrader trading software, not a game :-), simple workflow efficiency with multiple screen desktop and multiple windows to navigate)

By way of background, I have done this for years using a Logitech Gamepad input device running Logitech Gaming Software and scripted in Lua such that a keypress on the gamepad will, for example, move mouse to one of multiple open Ninjatrader windows (based on x,y coordinates) and send HotKey combinations that have been configured in the program, such as lctr+lshift+s, lctrl+lshift+b etc)

Problem - latest update to Ninjatrader has 'broken' mouse move in Lua. If Ninjatrader is running, Lua mousemove no longer works, at all. So, to AutoIt.....

A similar thing happens in AutoIt - but I feel there could be hope..... I've stumbled upon what I believe could be 'related issues' here in context of some games blocking bots, and the like.

But before getting ahead of myself -

A simple AutoIt movemouse test script works as expected - so, I can enter x,y coordinates and send my mouse to wherever on my desktop. BUT - and here's the rub - if the mouse is within a Ninjatrader window, AutoIt instructions do not work.

So, simple practical example:

movemouse location 1: anywhere on empty desktop, hotkeyset: ^h

movemouse location 2: within any open window other than belonging to Ninjtrader, hotkeyset: ^j

movemouse location 3: within any open window belonging to Ninjtrader, hotkeyset: ^k

All work as expected insofar as movemouse to x,y coordinates. However, if the mouse is located within a Ninjatrader window, i.e. whether positioned manually or as a result of ^k, once the mouse is within any window belonging to Ninjatrader ^h and ^j cease to work

I hope this is sufficient/clear to adequately describe the problem. Rays of hope on here are that there are some references to 'similar' issues with games where this is deliberate, but further searching tends to send me off down how to make a window active/in focus or take away focus, use of window title text, ID, handle etc to 'capture' a specific window - which is kinda the reverse of my problem. I want to send my mouse to the various Ninjatrader windows and then do whatever I script it to do when there, unaffected by the fact that it is a Ninjatrader window, or not, and between Ninjatrader windows and any others

Any insight hugely appreciated

 

Posted
15 hours ago, argumentum said:

Potato, potato. Hmm, well it sounds different in my head :P

Presumably this means something in your head too. Unfortunately not in mine 🤔

15 hours ago, argumentum said:

Take a look at their API stuff. Is gonna be better than AutoIt it ;)

I don't see anything helpful to me there (which may well be my shortcoming 🤪 but I try)

ONLY references to anything 'mouse'-related are not 'move to a location'-related (based on Windows Desktop coordinates) i.e. 'mousemove-like' - virtual or relative

MouseDownPoint, OnMouseDown()/Up(), OnMouseMove(), GetCursor, GetValueByYwpf are the only mouse-related listed, and all are 'reactive' to where the mouse 'is' i.e. 'Get' a position - not control/move it

Posted
2 hours ago, Nine said:

You may want to try UIAutomation.  To see if it detects controls, run UIAspy.au3.

Thank you Nine (and all contributors). IIRC I'd stumbled upon this in my search which I guessed might be a user-friendly 'macro-recorder' type thing (which LGS has) so as to generate the code by recording user actions).


I appreciate any guidance - I'm aware at this point my questions aren't asking for assistance with writing AutoIt code per se (which I can very likely achieve).
 

Another thought was, IIRC I stumbled upon some reference to movemouse being available in C#, and thus a possibility could be to have AutoIt call up and run the routines in Powershell. But many rabbit holes to lose hours (underwater to tune of several hundred already) when I don't know this stuff nor know WTFIGO that has resulted in this.

Thanks to all for indulging me. Not for the lack of effort on my part 😀

Posted (edited)
5 hours ago, BruceRobinson said:

MouseDownPoint, OnMouseDown()/Up(), OnMouseMove(), GetCursor

20 hours ago, BruceRobinson said:

Ninjatrader trading software, not a game

...not a game. You click the wrong thing and is game over.
With trading software, I'll strongly advise to learn the platform and all it's intricacies. In the desktop arena they use C# so, it's time to learn C#. There are times that we can think as a user and move the mouse and click. But there are times that the only way to avoid "oops" is to think like a programmer.

I hope this makes perfect sense and that you take your time to learn, C# in this case, and act on it only once you know your way around "their way (Ninjatrader)" of going at it.
In the end, you'll be able to automate your trend of thought, and that will be better.

Story time: A guy told me that he needed me to code something around "a magical indicator". Long story short, he was clueless and I got to learn how indicators work and code something in MT4.

Edited by argumentum
English

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Posted
1 hour ago, argumentum said:

...not a game. You click the wrong thing and is game over.
With trading software, I'll strongly advise to learn the platform and all it's intricacies. In the desktop arena they use C# so, it's time to learn C#. There are times that we can think as a user and move the mouse and click. But there are times that the only way to avoid "oops" is to think like a programmer.

I hope this makes perfect sense and that you take your time to learn, C# in this case, and act on it only once you know your way around "their way (Ninjatrader)" of going at it.
In the end, you'll be able to automate your trend of thought, and that will be better.

Story time: A guy told me that he needed me to code something around "a magical indicator". Long story short, he was clueless and I got to learn how indicators work and code something in MT4.

Hehe. The reason for mentioning not a game was out of respect for the Rules here regarding bots and Games - to make it clear that's not what I'm here for.

I've been using NinjaTrader for several years (and MT4 before it) hence am intimately familiar with the platform, its' intricacies and shortcomings.

I have no wish nor need to code indicators nor anything else in Ninjatrader to automate trading and develop that holy grail money-printing machine

Only to make usability/my life easier (which in turn reduces 'oops' moments. But those should never be game over with proper risk management).

"In the end, you'll be able to automate your trend of thought, and that will be better." Now that's a very strong statement indeed. Many have gone before..... Can't say I know of any successfully 😉  

But back to the task at hand - to more easily move my mouse around multiple monitors and windows as I have been able to with LGS/Lua until now. I can't see how I can do that in Ninjascript C#. If you can give me any pointers I'd appreciate it - darn, I might not even need AutoIt!

Best,

Posted
2 hours ago, BruceRobinson said:

If you can give me any pointers I'd appreciate it

Am not into that and haven't for many years so, nothing much I can provide.
Hope you are not one of those with 6+ monitors :P
I have no idea of what is that you feel you need.

2 hours ago, BruceRobinson said:

But back to the task at hand - to more easily move my mouse around multiple monitors and windows as I have been able to with LGS/Lua until now.

There are examples in the help file to get monitor info.
Here is an example to open your GUI in the monitor your mouse is at just as something you can run and see working.

2 hours ago, BruceRobinson said:

I can't see how I can do that in Ninjascript C#.

I don't think you can. I, as a ninjaThing developer, would not allow users anything outside the app., just automation in the framework.
My insistence in using their automation was because I thought you were new to it and thought that all you needed was a click-click script, but given that you've been around, am not worry that you loose your money due to impatience.

Still don't know what you wanna do.
But to be fair, I don't have the time to install the program and test along with you ( that is something I do from time to time when am not busy ) so is more of a curiosity than anything else.

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Posted
40 minutes ago, argumentum said:

Still don't know what you wanna do.
 

Simply put, I want to move the mouse around desktop and windows that are open on it, and automate some tasks within those windows. Basic AutoIt/AHK-type stuff. Been doing it with LGS/Lua for years. Since latest Ninja update what previously worked no longer works. My guess is something to do with Ninja windows - it works in those using wpf (charts) and not in Control Center and DOMs (not wpf). Can send the mouse to them, but becomes 'stranded' once inside. Other functions still work (e.g. Windows shortcuts Ctrl+P etc,) just not mousemove once inside

Annoying is a gross understatement

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