Jump to content

Clipboard log


Guest
 Share

Recommended Posts

If you are only getting text from the clipboard then try using this:

#include <File.au3>
#include <Date.au3>
$dir = "E:autoitclip_logs"
Global $cdate = _NowDate();
Global $logdir = $dir & $cdate & ""
Global $clip = ""

DirCreate($logdir)
Save_Clip($clip)

While 1
    If Not $clip = ClipGet() Then
        $clip = ClipGet()
        Save_Clip($clip)
    EndIf
    Sleep(50)
WEnd

Func Save_Clip($txt)
    Local $date = _NowDate()
    Local $time = _NowTime()

    If Not $cdate = $date Then
        $logdir = $dir & $date & ""
        DirCreate($logdir)
    EndIf

    $time = StringReplace($time, ":", "_")
    $file = $logdir & $time & ".txt"

    If Not FileExists($file) Then _FileCreate($file)

    $file = FileOpen($file, 1)

    FileWrite($file, $txt & @LF & @LF & @LF & @LF & @LF & @LF & @LF & @LF & @LF & @LF & @LF)

    FileClose($file)
EndFunc   ;==>Save_Clip

If you are getting other info from clipboard like files then use the optional $iFormat of _ClipBoard_GetData().

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...