How can I know if the user has clicked in a button ?

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
Reimon
Pro Scripter
Posts: 55
Joined: Wed Mar 31, 2004 4:46 pm

How can I know if the user has clicked in a button ?

Post by Reimon » Tue May 22, 2007 12:28 pm

Hello !!!

How can I know if the user has clicked in a button of a window?

Greetings,

Reimon

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 May 22, 2007 12:40 pm

Of another window? Most likely you can't. What happens when the user clicks on that button? Maybe the outcome of pressing that button is something you can detect? e.g. if pressing that button causes a window to appear than you could have a macro recognise when that window appears ...
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

Reimon
Pro Scripter
Posts: 55
Joined: Wed Mar 31, 2004 4:46 pm

How can I know if the user has clicked in a button ?

Post by Reimon » Tue May 22, 2007 1:15 pm

Marcus,

OK. Thank you very much for your idea.

Greetings

Reimon

Aaron
Pro Scripter
Posts: 113
Joined: Mon Apr 09, 2007 1:35 am
Location: Wyoming

check out this link

Post by Aaron » Tue May 22, 2007 6:01 pm

http://www.mjtnet.com/usergroup/viewtop ... 1421#11421

Check out this link, Of course you would need to now where on the window the button is located.

This script below is one that I made with help from the link above.

The script below will find the top x,y and bottom x,y positions and display them in a MessageModal.

start the macro.
Hold down the shift key and drag from the top left corner to the bottom right and let go.
To Close the macro, hold down the ctrl + alt + End keys.



// Set Bounds Here

Let>X1=0
Let>Y1=0
Let>X2=0
Let>Y2=0
Let>NotFalse=True


Label>MainLoop
Wait>0.2

OnEvent>KEY_DOWN,VK35,5,END

OnEvent>KEY_DOWN,VK1,1,LDownMouseClick
GetCursorPos>X1,Y1

Goto>MainLoop

//-----------

SRT>LDownMouseClick
Wait>0.2
IF>LUpLDown
GoSub>GetUpPosition
ELSE
GoSub>LDownMouseClick
ENDIF

Code: Select all

//------------

SRT>GetUpPosition
 GetCursorPos>X2,Y2
End>GetUpPosition

   GoSub>MsgMod

SRT>MsgMod
 MessageModal>%X1%,%Y1%,%X2%,%Y2%
End>MsgMod

 Goto>MainLoop

SRT>END
 Goto>ENDMACRO
End>END

label>ENDMACRO

//----END-----
Aaron

Reimon
Pro Scripter
Posts: 55
Joined: Wed Mar 31, 2004 4:46 pm

Thanks

Post by Reimon » Mon May 28, 2007 3:22 pm

Aaron.

Very thanks.

Reimon.

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