Jump to content
Sign in to follow this  
kekzoj

(mouse) key sequence

Recommended Posts

kekzoj

Hello,

I'm new to this forum and the fact I'm here is because my arms are beginning to show serious RSI symptoms.

I use my computer a lot for my job and it would be nice if some handlings can be shortened.

For instance I have to use the mouse a lot, and for specific program always in the same sequence.

It would be nice if I had the possibility to click on one (mouse)key and the following happens:

Left click on coordinates x,y;

Left click on other coordinates x,y;

Enter.

Not only I save time with this, I also have to use the mouse less often then I do now. Any help is appreciated.

Thanks in advance!

Share this post


Link to post
Share on other sites
gcue

welcome to the forum =)

see MouseClick

and Send

in the help file

Share this post


Link to post
Share on other sites
Blue_Drache

Wellllllll.... the way you're asking to do it smells of a keylogger. Rather sensitive subject around here.


Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
Share on other sites
Melba23

Blue_Drache,

Where on earth do you get the idea that this is a keylogger? :huh:

It sounds like a perfectly good use of AutoIt to me. :)

kekzoj,

Welcome to the AutoIt forum. :)

What application are you trying to automate? Are the positions of these 2 clicks existing controls within the application GUI? The more you can tell us the better we can help. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Blue_Drache

Blue_Drache,

Where on earth do you get the idea that this is a keylogger? :huh:

Wouldn't one have to have a program running continuously in the background watching for a mouseclick to capture it and then spit out its modified meaning?


Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
Share on other sites
kekzoj

The program I use is for calculating the General Old Age Pensions Act. Lots of variables to it, for example: if someone has lived a couple of years in another country, he gets less money.

It's a quite simple (and ugly windows95 looking) program, windowed, but fullscreen on my left monitor. On my right screen I use other programs, like IE8.

With every case I treat, I have to look up a lot of data. In practical terms, every two (or less) minutes, I have to use the exact same keys to look up information.

Share this post


Link to post
Share on other sites
Melba23

Abraluna,

You must have missed the fact that a moderator popped in to clear the question just above your post. ;)

And I do not think we are "hostile" - your own thread could arguably have been "suspect" and yet I see no sign of anything other than useful posts in reply. And alas, when we do query the intentions of those who ask "suspect" questions far too often our suspicions are proved correct - and we do have Forum Rules here which we expect people to follow. :(

I hope you stick around long enough to change your opinion of us. :)

Blue_Drache,

And since when does that make a keylogger? Have you never used a HotKey in a script? Go and read this announcement which sets out our policy on what is and is not a keylogger. ;)

And in any event, rather than jump in "all guns blazing", why not just report the thread and let a Mod look at it? That is why we are here. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
DicatoroftheUSA

@original post

If I was in your situation, I would use "hotkeyset". Look it up in the help file. Try to throw together a rough script, and let us know where exactly you get stuck and we can help.

For rehab I suggest http://www.powerballs.com/index.php?m=Home .

I am not affilated with the above, but it did help with my guitar training.

Edited by DicatoroftheUSA

Share this post


Link to post
Share on other sites
kekzoj

@original post

If I was in your situation, I would use "hotkeyset". Look it up in the help file. Try to throw together a rough script, and let us know where exactly you get stuck and we can help.

For rehab I suggest http://www.powerballs.com/index.php?m=Home .

I am not affilated with the above, but it did help with my guitar training.

Thanks ;)!

At the moment I got this:

HotKeySet("{}", "IB")

Func IB()

MouseClick ( "left" [, 1100, 194 [, 1 [, 10]]] )

MouseClick ( "left" [, 530, 284 [, 1 [, 10]]] )

{Enter}

HotKeySet("{/}")

Send("{/}")

HotKeySet("{/}", "IB")

EndFunc

Maybe it's a lot easier to do with only the mouse? Then one click automatically does 3 at a time?

If MouseClick ( "left" [, x, y [, 1 [, 10]]] ) Then

MouseClick ( "left" [, 1100, 194 [, 1 [, 10]]] )

MouseClick ( "left" [, 530, 284 [, 1 [, 10]]] )

{Enter}

The program should be running at all time; whenever I click the left mouse button, the sequence activates.

I'm thinking I'm going to use the mousewheelbutton, because I never use that one.

Let me know what you think!

Share this post


Link to post
Share on other sites
DicatoroftheUSA

I am not sure what you are asking for. I personally avoid using the mouse as much as I can. It is up to you for what works for you.

Either way should work.

Edited by DicatoroftheUSA

Share this post


Link to post
Share on other sites
kekzoj

I am not sure what you are asking for. I personally avoid using the mouse as much as I can. It is up to you for what works for you.

Either way should work.

A like to avoid a sequence of mouseclicks, but one click is no problem. Because in between I mainly use the keyboard.

It should be kind of easy, but because I'm very new to this, I miss the knowledge to put that little script above in a real working 'program'.

Share this post


Link to post
Share on other sites
DicatoroftheUSA

#include <Misc.au3>

_main()

Func _main()
Local $hDLL = DllOpen("user32.dll") ; _make _ispressed faster
Local $aPosition
While 1
Sleep(30) ; reduce cycles
$aPosition = MouseGetPos()
If Not _CheckCords($aPosition, 0, 0, 400, 300) Then ContinueLoop
#region _check for click
If Not _IsPressed(01, $hDLL) Then ContinueLoop
While _IsPressed(01, $hDLL)
Sleep(30) ; reduce click jitter
WEnd
#endregion _check for click
_DoStuff()


WEnd
EndFunc ;==>_main

Func _CheckCords($aPosition, $X1, $Y1, $X2, $Y2)
;~ _ArrayDisplay($aPosition)
If $X1 < $aPosition[0] And $aPosition[0] < $X2 Then
If $Y1 < $aPosition[1] And $aPosition[1] < $Y2 Then

Return 1

EndIf
EndIf
Return 0

EndFunc ;==>_CheckCords

Func _DoStuff()
ConsoleWrite("hurray")
EndFunc ;==>_DoStuff;==>_DoCLicks

This should get you started.

Also, in the help files, and most technical help files, brackets means it is an optional input, not something that is literally needed in the command.

eg.

MouseClick ( "button" [, x, y [, clicks [, speed]]] ) means, MouseClick ( "left") and MouseClick ( "left",10,10) are valid and will work. But MouseClick ( "left,[, 1100, 194 [, 1 [, 10]]] ) OR Mouseclick() is not and won't work.

Edited by DicatoroftheUSA

Share this post


Link to post
Share on other sites
kekzoj

#include <Misc.au3>

_main()

Func _main()
Local $hDLL = DllOpen("user32.dll") ; _make _ispressed faster
Local $aPosition
While 1
Sleep(30) ; reduce cycles
$aPosition = MouseGetPos()
If Not _CheckCords($aPosition, 0, 0, 400, 300) Then ContinueLoop
#region _check for click
If Not _IsPressed(01, $hDLL) Then ContinueLoop
While _IsPressed(01, $hDLL)
Sleep(30) ; reduce click jitter
WEnd
#endregion _check for click
_DoStuff()


WEnd
EndFunc ;==>_main

Func _CheckCords($aPosition, $X1, $Y1, $X2, $Y2)
;~ _ArrayDisplay($aPosition)
If $X1 < $aPosition[0] And $aPosition[0] < $X2 Then
If $Y1 < $aPosition[1] And $aPosition[1] < $Y2 Then

Return 1

EndIf
EndIf
Return 0

EndFunc ;==>_CheckCords

Func _DoStuff()
ConsoleWrite("hurray")
EndFunc ;==>_DoStuff;==>_DoCLicks

This should get you started.

Also, in the help files, and most technical help files, brackets means it is an optional input, not something that is literally needed in the command.

eg.

MouseClick ( "button" [, x, y [, clicks [, speed]]] ) means, MouseClick ( "left") and MouseClick ( "left",10,10) are valid and will work. But MouseClick ( "left,[, 1100, 194 [, 1 [, 10]]] ) OR Mouseclick() is not and won't work.

thanks a lot!

"CheckCords", try to search what this means, but Google says this function doesn't exist, O_O

I'm really a rookie, but where should I enter the coordinates? (1100, 194 for the first click and 530, 284)

Share this post


Link to post
Share on other sites
DicatoroftheUSA

thanks a lot!

"CheckCords", try to search what this means, but Google says this function doesn't exist, O_O

_checkCords was a custom function, if you look at the function below where it is called, its parameters are in the form X1,Y1,X2,Y2. Or in short, the top corner, then bottom corner. You would use autoit window info utility to find the corner coordinates of the button you need. In the above example, (0,0,300,400) means a box that is in the top left of your monitor.

Functions look like the following

func _funcname($parameters)
;do stuf
endfunc
[endfunc]

My func is as follows. It returns 1 or 0. Autoit generally interprets non 0 as a true condition. So in plain English, the following function says check the condition whether the mouse is between the two sets of coordinates. If so tell the script the condition is true (1), else tell the script the condition is false(0).

Func _CheckCords($aPosition, $X1, $Y1, $X2, $Y2)
;~ _ArrayDisplay($aPosition)
If $X1 < $aPosition[0] And $aPosition[0] < $X2 Then
If $Y1 < $aPosition[1] And $aPosition[1] < $Y2 Then

Return 1

EndIf
EndIf
Return 0

EndFunc ;==>_CheckCords

Before googling around, read the included autoit it help file. It has almost everything you need.

Also if you have time, I recommend

So to answer you question

I'm really a rookie, but where should I enter the coordinates? (1100, 194 for the first click and 530, 284)

rectangles need to be described with at least four coordinates. In my function, you would inter the top corner and then bottom corner of your button you first click on. If you don't care where you first click (I strongly do not recommend it) you could simply comment out the lines

$aPosition = MouseGetPos()
If Not _CheckCords($aPosition, 0, 0, 400, 300) Then ContinueLoop
Edited by DicatoroftheUSA

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×