mousemove?
Moderators: JRL, Dorian (MJT support)
mousemove?
I'm hitting a wierd situation with a script I put together. I'm fairly new at this, so wondered if you could spot where i'm going wrong. Basically the script does this...
right clicks to open a menu, selects an option. It then moves the cursor to an already open window, left clicks, drags what it has to another open window and drops it into there. It then repeats the process.
label>start
wait>8
mousemove>150,676
wait>1
rclick
wait>1
mousemove>190,762
wait>1
lclick
wait>3
mousemove>100,630
wait>1
ldown
wait>1
mousemove>100,476
wait>1
lup
goto>start
Now what's happening is the script will work as expected 95 perc of the time, however sometimes one of the mousemoves takes the cursor to the bottom middle of my display (approximately). instead of the specified coordinates.
Any ideas? I'm using version 7.2.050e
right clicks to open a menu, selects an option. It then moves the cursor to an already open window, left clicks, drags what it has to another open window and drops it into there. It then repeats the process.
label>start
wait>8
mousemove>150,676
wait>1
rclick
wait>1
mousemove>190,762
wait>1
lclick
wait>3
mousemove>100,630
wait>1
ldown
wait>1
mousemove>100,476
wait>1
lup
goto>start
Now what's happening is the script will work as expected 95 perc of the time, however sometimes one of the mousemoves takes the cursor to the bottom middle of my display (approximately). instead of the specified coordinates.
Any ideas? I'm using version 7.2.050e
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
Note that MouseMove is using absolute screen positions, not window positions. You might want to use MouseMoveRel within each window after you do SetFocus> on the window. You only need to be off by one pixel to have a failure.
I generally try to use keystrokes vs. Mouse Movements. Using Tabs, ALT-CTL key combinations, etc. to move between applications, select menu choices, etc.
I generally try to use keystrokes vs. Mouse Movements. Using Tabs, ALT-CTL key combinations, etc. to move between applications, select menu choices, etc.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!
Hello Silvercrow,
Apparently, your script is fine, at least 95%. Nonetheless, your script attracts inquisitive attention as follows:
(1) Is it the only script running when the incident occurs?
(2) Is the window/task of interest maximzed?
(3) Is the window in question a dialog box?
(4) Does it move around sometimes?
(5) Is the physical mouse being moved around when running the script?
(6) Does the script involve more than one (1) window?
(7) Is one second enough time to pop up the context-sensitive menu after right-clicking the mouse?
Look forward to hearing from you. Happy scripting.
Apparently, your script is fine, at least 95%. Nonetheless, your script attracts inquisitive attention as follows:
(1) Is it the only script running when the incident occurs?
(2) Is the window/task of interest maximzed?
(3) Is the window in question a dialog box?
(4) Does it move around sometimes?
(5) Is the physical mouse being moved around when running the script?
(6) Does the script involve more than one (1) window?
(7) Is one second enough time to pop up the context-sensitive menu after right-clicking the mouse?
Look forward to hearing from you. Happy scripting.
mousemove?
I did look at the setfocus, however the windows being dealt with are internal to another application i.e. they're windows with a window. I found when using the setfocus, even with wildcards it minimised the application, which was not desirable. Heh i'm prolly missing something obvious here, so if there's a way round this, that would be useful as absolute mouse coords are a pain in the ass 
In response to your questions armsys,
1/ Yes it's the only script running.
2/ The application window is maximised. However the 2 windows i'm dragging stuff between live within this maximised window and are not in themselves maximised.
3/ No it's not a dialog box, it's just a window I drag and drop into.
4/ The 2 windows can be moved, but generally they are static, and are always in the same place on screen.
5/ Yes the mouse does get moved, however this problem occurs even when you leave the mouse alone.
6/ see 2
7/ Yes, the pop up menu appears almost instantaneously.
BTW, thanks for the replies guys, your help is very appreciated.

In response to your questions armsys,
1/ Yes it's the only script running.
2/ The application window is maximised. However the 2 windows i'm dragging stuff between live within this maximised window and are not in themselves maximised.
3/ No it's not a dialog box, it's just a window I drag and drop into.
4/ The 2 windows can be moved, but generally they are static, and are always in the same place on screen.
5/ Yes the mouse does get moved, however this problem occurs even when you leave the mouse alone.
6/ see 2
7/ Yes, the pop up menu appears almost instantaneously.
BTW, thanks for the replies guys, your help is very appreciated.
Hi Silvercrow,
Thanks for your comprehensive reply.
Looking up your script again, I notice it constitutes an infinite loop. I'm not sure how you can stop it.
(1) Does the unexpected mouse movement occur during the 1st loop? I would guess the anomaly occassionally occur much later.
(2) Has the hourglass cursor ever shown up momentarily when running the script?
Please give the following script a shot:
Thanks for your comprehensive reply.
Looking up your script again, I notice it constitutes an infinite loop. I'm not sure how you can stop it.
(1) Does the unexpected mouse movement occur during the 1st loop? I would guess the anomaly occassionally occur much later.
(2) Has the hourglass cursor ever shown up momentarily when running the script?
Please give the following script a shot:
Hope the above script can boost your success rate to 99%.label>start
WaitCurosrChanged>8
WaitReady>1
mousemove>150,676
Wait>.2
rclick
mousemove>190,762
wait>.2
lclick
WaitReady>1
mousemove>100,630
wait>.1
ldown
wait>.1
mousemove>100,476
lup
Wait>1
WaitReady>1
goto>start
Re: mousemove?
FWIW I started having the same issue myself yesterday. Like you I am trying to automate drag and drop (in this case for a game) and the behaviour you describe is what I'm seeing. The windows I'm dragging between are game windows with the game being 'fullscreen'.silvercrow wrote:I'm hitting a wierd situation with a script I put together. I'm fairly new at this, so wondered if you could spot where i'm going wrong. Basically the script does this...
It started when I got a new laptop (yay!) with a 1280x1024 screen. The exact same macro that used to run for hours without fail now randomly and occasionally moves the cursor to the bottom right of the screen or possibly the target window.
The only factor I can see is that it seems to happen when the macro is releasing the dragged object.
I haven't had that much chance to play with this but the two possibilities I have come up with so far are:
1.Resolution
I'm a programmer myself so I have grave doubts about this but..could it be that MS is getting upset over the increased coordinate values? It's the most obvious explanation and therefore highly suspect. Surely it'd work or not work? In any case the largest coordinate value is 965 so I see no problems there.
2.Timing
Aside from having a bigger screen the new laptop is a lot faster. I've gone from 2.4G Celeron to 3.4P4. Furthermore I noticed last night that the lines:
random>3,wibble
wait>wibble+3
Don't seem to be waiting at all. It's supposed to wait for 'wibble' plus three seconds. I'm still using the March version of MS (checked for the update the day before,

This seems to be a case of bad editing since at the top of the file I have:
let>wibble=wibble+3
But no where else.
Could it be that on a slower machine I've been getting away with a shoddy macro? The Game I'm playing has a slightly odd (hand crafted) UI and I wouldn't expect it to have the same foibles as Explorer.
Late last night I fixed the delay but it was getting late so I didn't have a chance to try it. BTW if your macro has anything to do with mining drop me a mail

- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
I doubt that speed is the issue, but can not rule it out. I suspect it is a resolution/coordinate/focus problem
Can you please provide sample of the code and show where the problem occurs, and explain the symptoms?
You say that it does not appear to wait, but you can verify that by looking at the times in the log. If no log available, then make one and check that out.
Can you please provide sample of the code and show where the problem occurs, and explain the symptoms?
You say that it does not appear to wait, but you can verify that by looking at the times in the log. If no log available, then make one and check that out.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!
Will not work because you cannot have expression in the wait command. The following will work:random>3,wibble
wait>wibble+3
random>3,wibble
Let>wibble=wibble+3
Wait>wibble
MJT Net Support
[email protected]
[email protected]
Here is the script. I get the same behaviour with the latest version (7.3) of MS. I also installed the Logitech drivers for my mouse incase that was the issue. I also moved the windows to their original positions but that didn't help (I didn't expect it to but might as well test it).
The macro is working but it's not ideal. It looks kind of odd and sometimes glitches since missing too many drag drops upsets the game a bit.
label>loop
MouseMove>95,960
GoSub>WaitAWhile
LDown
GoSub>WaitAWhile
MouseMove>600,960
GoSub>WaitAWhile
LUp
GoSub>WaitAWhile
goto>loop
srt>WaitAWhile
random>2,wibble
let>wibble=wibble+0.5
wait>wibble
end>WaitAWhile
Right now the only thing I can think of is to write a mouse move routine and have it move the mouse and check for the position afterward. Unfortunately from the way the game is behaving I'm not sure this will help.
What puzzles me is that MS was working just fine (and still does) on my old laptop. /Something/ about the new machine has upset it.
The macro is working but it's not ideal. It looks kind of odd and sometimes glitches since missing too many drag drops upsets the game a bit.
label>loop
MouseMove>95,960
GoSub>WaitAWhile
LDown
GoSub>WaitAWhile
MouseMove>600,960
GoSub>WaitAWhile
LUp
GoSub>WaitAWhile
goto>loop
srt>WaitAWhile
random>2,wibble
let>wibble=wibble+0.5
wait>wibble
end>WaitAWhile
Right now the only thing I can think of is to write a mouse move routine and have it move the mouse and check for the position afterward. Unfortunately from the way the game is behaving I'm not sure this will help.
What puzzles me is that MS was working just fine (and still does) on my old laptop. /Something/ about the new machine has upset it.
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
Basic script looks good, appears to run OK.
To troubleshoot, try some of these approaches:
1. Try adding bigger number to wibble so you can see the mouse movement.
2. Try looking at your log to see if it is going to the positions you called for.
3. Try adding SetFocus before every MouseMove command, and repeating options 1 and 2..
To troubleshoot, try some of these approaches:
1. Try adding bigger number to wibble so you can see the mouse movement.
2. Try looking at your log to see if it is going to the positions you called for.
3. Try adding SetFocus before every MouseMove command, and repeating options 1 and 2..
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!
The mouse movement is visible anyway. When it goes wrong it's obviously wrong. Sometimes it goes to the bottom right of the screen sometimes just 'too far' to the right and at the bottom of the screen.Bob Hansen wrote:Basic script looks good, appears to run OK.
To troubleshoot, try some of these approaches:
1. Try adding bigger number to wibble so you can see the mouse movement.
The log looks fine unfortunately.2. Try looking at your log to see if it is going to the positions you called for.
Unfortunately this doesn't work. I think that the game is using its own UI and it just happens to modelled on the Windows UI.3. Try adding SetFocus before every MouseMove command, and repeating options 1 and 2..
What I'm going to do tonight is modify the script to either enter a loop reading the cursor position and wait until it's correct or else at least log the cursor position. I'm hoping that the UI is just misinterpreting the mousemove instruction and that it knows where the cursor ended up.