MouseMove Problem

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
eonerhime
Newbie
Posts: 2
Joined: Tue Dec 06, 2011 5:21 pm

MouseMove Problem

Post by eonerhime » Tue Dec 06, 2011 5:36 pm

I wrote this macro to automate a task in a game, the problem is the mouse never comes back to the original position for some reason (it used to). I've also tried using MouseMoveRel but that did not solve the problem, please help :)

Label>Start
wait>1
Press NP1
wait>0.25
press NP1
wait>1
MouseMove>40,0
wait>1
Press NP1
wait>0.25
press NP1
wait>1
MouseMove>40,0
wait>1
Press NP1
wait>0.25
press NP1
wait>1
MouseMove>40,0
wait>1
Press NP1
wait>0.25
press NP1
wait>1
MouseMove>40,0
Press NP1
wait>0.25
press NP1
wait>1
MouseMove>-200,0
wait>1
Press NP1
wait>0.25
press NP1
wait>7
MouseMove>40,0
wait>1
Goto>Start
Label>End

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Tue Dec 06, 2011 6:09 pm

This code moves the mouse to position 40,0 but doesn't do anything to move it back to wherever it was before the script was started. To do that you can add code as follows:

//at top of script
GetCursorPos>origX,origY

... your code here

//at end of script
MouseMove>origX,origY
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

eonerhime
Newbie
Posts: 2
Joined: Tue Dec 06, 2011 5:21 pm

Post by eonerhime » Tue Dec 06, 2011 7:02 pm

I tried adding the extra code as you suggested, but the cursor just vanishes from the screen and nothing happens. Here's what I did:

Label>Start
GetCursorPos>origX,origY
wait>1
Press NP1
wait>0.25
press NP1
wait>1
MouseMoveRel>40,0
wait>1
Press NP1
wait>0.25
press NP1
wait>1
MouseMoveRel>40,0
wait>1
Press NP1
wait>0.25
press NP1
wait>1
MouseMoveRel>40,0
wait>1
Press NP1
wait>0.25
press NP1
wait>1
MouseMoveRel>40,0
Press NP1
wait>0.25
press NP1
wait>1
MouseMoveRel>-200,0
wait>1
Press NP1
wait>0.25
press NP1
wait>7
MouseMove>origX,origY
wait>1
Goto>Start
Label>End

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts