Hints, tips and tricks for newbies
Moderators: JRL, Dorian (MJT support)
-
eonerhime
- Newbie
- Posts: 2
- Joined: Tue Dec 06, 2011 5:21 pm
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
-
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
-
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