Jump to content
Sign in to follow this  
rocko

Mouse Click Detection

Recommended Posts

rocko

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

Share this post


Link to post
Share on other sites
rocko

*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?

Share this post


Link to post
Share on other sites
Danyfirex

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

Share this post


Link to post
Share on other sites
PhoenixXL

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.

Share this post


Link to post
Share on other sites
Exit

This might help you.

<Code removed because I'm a dumbass and posted code that's one FileWriteLine() away from being a keylogger>

Edited by Valik
See big text.

My UDFs, Abbrevs and Snippets
If you like my post, just click the like button :) 

Share this post


Link to post
Share on other sites
Valik

Exit, I suggest you engage your brain before you post code like that again or you'll find yourself on the wrong side of an block list.

Thread locked since it went to a bad place.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

×