Jump to content

Cliplogger


Marlo
 Share

Recommended Posts

This is pretty much my first Example script in all the time i've been on this forum :mellow: So hope it goes down well

So basicly it just logs all String values that have been coped to the clipboard.

The clip entrys are then saved to an ini file along with a time stamp

Global Const $sLogFile = @ScriptDir & "\ClipLogger.ini" ;File to save the information to
Global $sLastClip = ""                                  ;a record of the previous clipboard entry

_ReduceMemory()
While Sleep(250)
    _CheckClipboard()
WEnd

;Checks to see if there has been a new clipboard entry.
Func _CheckClipboard()
    Local $sCurrentClip = ClipGet()
    If Not $sCurrentClip Then Return 0
    If $sCurrentClip <> $sLastClip Then
        _AddToLog($sCurrentClip)
        $sLastClip = $sCurrentClip
    EndIf
EndFunc   ;==>_CheckClipboard

;Adds the clip entry to the file
Func _AddToLog($sValue)
    Local $hFile = FileOpen($sLogFile, 1)
    FileWriteLine($hFile, _Time() & " " & $sValue)
    FileClose($hFile)
EndFunc   ;==>_AddToLog

;Returns the current time in HH:MM:SS format
Func _Time()
    Return @HOUR & ":" & @MIN & ":" & @SEC
EndFunc   ;==>_Time

;Reduce the memory used up by the script
;Thanks to jftuga for the idea behind this function
Func _ReduceMemory()
    Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', -1)
EndFunc   ;==>_ReduceMemory

Comments?

Click here for the best AutoIt help possible.Currently Working on: Autoit RAT
Link to comment
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
 Share

  • Recently Browsing   0 members

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