PDA

View Full Version : Creting a Mouse ation macro with the MFP



Raystar
27th March 2009, 05:21 PM
Hello everybody.

I'm trying to assign one of my MFP keys (the MFP is the only device associated to the profile and I'm using the #16 button --> JS1.B16) a macro to perform the following steps:

- record the actual position of the mouse pointer
- click the left mouse button
- while keeping the mouse button move the mouse pointer to a specified location (let's use x=200, y=400 as an example)
- release the left mouse button
- move the mouse pointer back to the previously recorded position

Until now I put together the following:

script

if (JS1.B16) then
A1 = SCREENX; //save x coordinate
A2 = SCREENY; //save y coordinate
CMS.B2 = TRUE, //activate the left mouse mouse button
SCREENX = 200; //move mouse pointer
SCREENY = 400; //move mouse pointer
CMS.B2 = FALSE; //release the mouse left button
SCREENX = A1; //move mouse pointer back to saved position
SCREENY = A2; //move mouse pointer back to saved position
endif

endscript

As you can imagine by the fact that I'm asking for help, the script doesn't do what I think it should do. I'm sure I'm missing something about the way I should program it, any help you guys/gals could give me?

Thanks in advance,
Francesco

Bob Church
27th March 2009, 11:50 PM
Hi Francesco,

Try setting it up as a SEQUENCE, then put delays between each of the mouse changes. As it's written, it's going to go through the whole thing in one pass, none of the commands will have any effect outside of the script itself. If you write it as a SEQUENCE, you can put a "DELAY( 1 )" or something similar between each set of changes that needs to happen and that will let the PC respond.

If that doesn't help, come on back and we'll figure something out.

Best regards,

- Bob

The StickWorks
http://www.stickworks.com

Raystar
28th March 2009, 11:00 AM
Thanks a lot!!

I played a bit with the delays and found the right combination...it works!!

Thanks again,
Francesco

Bob Church
28th March 2009, 02:05 PM
Hi Francesco,

You're quite welcome! I'm glad it was some help!

Best regards,

- Bob

The StickWorks
http://www.stickworks.com