Jump to content

Mouse Click Detection


rocko
 Share

Recommended Posts

Hi,

I'm new to AutoIt and i need some help. I want a script to be able to detect if an action is performed.

By action i mean either a mouseclick or a key stroke.

I want to do smth simple like :

Function Detect

{

i = 0

while 1 do

if (mouseclick) or (keystroke) then

i = i + 1

endif

wend

sleep(120000)

if i = 0 then

...

endif

else

call(detect)

}

I want the script to simply detect if any action is performed in a 2 minute interval. If actions ar performed i dont want it to do anything, if actions are performed i will write some instructions .

Thanks in advance

Link to comment
Share on other sites

*I want the script to simply detect if any action is performed in a 2 minute interval. If actions ar performed i dont want it to do anything, if actions *aren't* performed i will write some instructions .

Or is there a way to detect if the script stops runnning and to restart the script automatically?

Link to comment
Share on other sites

To detect if mouse or key is pressed use this.

#include <Misc.au3>
while 1
    if _IsPressed(01) Then
        msgbox(0,"","click sinistro")
    endif
if _IsPressed(41) Then
msgbox(0,"","A has been Pressed")
EndIf
    sleep(1)
wend
Edited by Danyfirex
Link to comment
Share on other sites

check

_Winapi_SetWindowsHookEx

that would be more efficient

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...