Sign in to follow this  
Followers 0
TimBillotti

Screen Shot and log when Mouse is clicked

4 posts in this topic

I am trying to log and take a screenshot every time the right or left mouse buttons are clicked. I have the script working for logging it to a .htm file but when I tried to add the screenshot part it broke. I am still a bit new to AutoIt so it is probably a stupid mistake. I just need the Screen shot to be taken every time the mouse is clicked and after it is logged to my .htm file. Any help you guys could provide would be greatly appreciated. Thanks!

The syntax check utility says this when run:

EnKryptic Log.au3(172,4) : ERROR: missing EndIf.

Func

^

C:\Users\Ariel\Scripts\EnKryptic Log.au3(168,29) : REF: missing EndIf.

If _IsPressed('01') Then

~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

C:\Users\Ariel\Scripts\EnKryptic Log.au3(172,4) : ERROR: missing Wend.

Func

^

C:\Users\Ariel\Scripts\EnKryptic Log.au3(108,1) : REF: missing Wend.

While

^

C:\Users\Ariel\Scripts\EnKryptic Log.au3(181,4) : ERROR: syntax error

EndIf

^

And Here is the code:

#include <ScreenCapture.au3>

If _IsPressed('01') Then

_KeyLog("<font color=#009900 style=font-size:9px><i>{LEFT MOUSE}</i></font>")

_Main()

Func _Main()

Local $hBmp

; Capture full screen

$hBmp = _ScreenCapture_Capture ("")

; Save bitmap to file

_ScreenCapture_SaveImage ($log&"\logfiles\"&$date&""&$datetime&".jpg", $hBmp)

EndIf ;==>_Main

EndIf

If _IsPressed('02') Then

_KeyLog("<font color=#009900 style=font-size:9px><i>{RIGHT MOUSE}</i></font>")

_Main()

Func _Main()

Local $hBmp

; Capture full screen

$hBmp = _ScreenCapture_Capture ("")

; Save bitmap to file

_ScreenCapture_SaveImage ($log&"\logfiles\"&$date&""&$datetime&".jpg", $hBmp)

EndIf ;==>_Main

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Thats just a jumbled mess of code im afraid

you will need to post what you have working, its not all there as the errors are on lines like 172 and such

EDIT: Im not saying it is, but if its a keylogger, dont bother posting it up.

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Your code has syntax errors all over. I can't understand enough what you're after with "Func _Main()" to fix your problem.

Of all the If...EnfIf and Func...EndFunc you got going on there, only one pair kinda matches. I say "kinda" because there's a stray Func stuck in between them, which also makes them syntactically incorrect.

This is the most I can make of it:

If _IsPressed('01') Then
    _KeyLog("<font color=#009900 style=font-size:9px><i>{LEFT MOUSE}</i></font>")
    _Main()
EndIf

If _IsPressed('02') Then
    _KeyLog("<font color=#009900 style=font-size:9px><i>{RIGHT MOUSE}</i></font>")
    _Main()
EndIf

Func _Main()
    Local $hBmp
    ; Capture full screen
    $hBmp = _ScreenCapture_Capture ("")
    ; Save bitmap to file
    _ScreenCapture_SaveImage ($log&"\logfiles\"&$date&""&$datetime&".jpg", $hBmp)
EndFunc ;==>_Main

Next time, post using [autoit] tags and use proper indentation when coding so you can easily check if your start and end tags match.

Edited by omikron48

Share this post


Link to post
Share on other sites

Thank you for all your help. As I said I am still new to AutoIt and that was my first forum post so please excuse the improper etiquette of my post. I will try to keep everything you guys shared with me in mind when posting anything else. Thank you so much Omni, after your post I saw the changes you made and it just clicked for me and I understood what I was doing wrong not only in this program but in a few others I am working on as well. Now that this program is finished it will make my life so much easier at work allowing me to track my clicks and review them later to count clicks to move through website and to access products and services and for logging time spent on a project.

Thanks a bunch everyone

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  
Followers 0