Hello,
I have this script which solely uses MouseMove. It works, but the script is not flexible. However, MouseMoveRel isn't a solution work either, because I am interacting a smaller "virtual" window (800x600) which is always centered within a "real" window (desktop resolution). When the real window (one recognised by macro utilities) resizes, the "virtual" window recenters itself, hence change relative positions within the master window.
This is even made more complicated since I would like to run the application on a secondary window (I am on a dual monitor system), and the start position (upper left corner) of a maximised window is not 0,0 anymore.
Still, I was wondering if there is a witty solution to the problem. Perhaps there is a way that I could hardcode the coordinates of the 800x600 "virtual window", and using some arithmetics, add/substracts values from my mousemove coordinates accordingly?
Before I look to make my own solution, I was wondering if anyone had run into this issue before.
Thank you.
Ax.
Edit:
Well, I can think of one solution, but it doesn't seem to work. First, I get the difference between the old position and new position.
//Original Position of the 'Virtual window'.
Let>OriginalX=450
Let>OriginalY=250
//Position of the 'Virtual window' in the new desired position.
Let>NewX=2000
Let>NewY=500
//Difference
Let>CX=NewX-OriginalX
Let>CY=NewY-OriginalY
The idea is that from there, by adding CX and CY to the original coordinates in my script, I would be able to the right position for where I want the window to be. And it does work. If I manually CX and CY to the respective X and Y coordinate of my mousemove, getpixelcolor etc. it would point to the right place. The problem of course, is that I do not want to re-edit every coordinate every single time. What I'd like to do then, is to be able to do something along the line of:
GetPixelColor>500+CX,300+CY,Test
If>Test=8000
MouseMove>500+CX,300+CY
LClick
End>
But MacroScheduler doesn't seem to welcome this syntax.
So is this something I could do by tweaking my syntax (I've tried adding % between the CX and CY to no avail), or does MacroScheduler simply not accept on-the-run coordinate calculations?
Regards,
Ax
Custom relative position?
Moderators: Dorian (MJT support), JRL
You may have already tried this but what info do you get if you use GetActiveWindow>. When the virtual window has focus, does GetActiveWindow> provide the coordinates of the "virtual" window or the coordinates of the "real" window. If by chance you can acquire the coordinates of the virtual window then you should be able to proceed from there.
Just a thought,
Dick
Just a thought,
Dick
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
If the window is a child window set GAW_TYPE to 1 before using GetActiveWindow:
Let>GAW_TYPE=1
GetActiveWindow>title,x,y,w,h
Let>GAW_TYPE=1
GetActiveWindow>title,x,y,w,h
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
You could also use the Image Recognition Library tool to find the top/left coordinates of the "virtual window", then work relative to those coordinates. Is this virtual window always the same resolution? For that matter, since you are only using MouseMove, then you could use Image Recognition Lib for the entire application. Then it wouldn't matter where the virtual window is located within the 'real' window....