QuestionAuto copy/paster

Posts 1–15 of 17 · Page 1 of 2
Auto copy/paster
Does someone knows how to make a program that paste text in a txt file when you copy something with Ctrl+C?
I found this :
Code:
^d::  ; Ctrl + d
Clipsaved := clipboardall
Clipboard =
Send ^c
Clipwait
Fileappend, %clipboard%`n, somefilename.txt
Clipboard := clipsaved
Run, somefilename.txt
Return
(ahk)
but it doesn't work for me.
Quote Originally Posted by Jim Morrison View Post
What language are you doing?
:/

nothing

Code:
Public Class Form1
    Public oldCPText As String = ""
    Public writeCount As Long = 0
  
 
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        If Clipboard.ContainsText() Then
            Dim tmpCPText As String = Clipboard.GetText
            If tmpCPText <> oldCPText Then
                ''new text in clipboard
                oldCPText = tmpCPText
                System****.File.AppendAllText("somefilename.txt", tmpCPText) ''save it to file
                writeCount += 1
                Label2.Text = writeCount.ToString()
                If CheckBox1.Checked Then
                    Beep()
                End If
            End If
        End If
    End Sub


End Class
link to executable (requires .net framework 4.0 or higher): h t t p : / / www. file dropper . com/autocpsave
 
Jotti Malware Scan

http://virusscan.jotti.org/en/scanre...5a2901f6051174
MD5: ee07a06e3fe8500b200ba3686e8a106d
SHA1: 93bc2eb02938dfe33e5e21160ea5df9ce1a424bd

^^ @ moderator, please upload to your file server or whatnot? I don't see "Reply with attachment" option, and wasn't going to start a new thread.

@OP, compile the source yourself..don't run the executable I posted until a moderator approves it.

Might not be the best solution, but should do what you're asking. ? Hopefully you're not copying hundreds of megs of text at a time..
Quote Originally Posted by abuckau907 View Post

Code:
Public Class Form1
    Public oldCPText As String = ""
    Public writeCount As Long = 0
  
 
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        If Clipboard.ContainsText() Then
            Dim tmpCPText As String = Clipboard.GetText
            If tmpCPText <> oldCPText Then
                ''new text in clipboard
                oldCPText = tmpCPText
                System****.File.AppendAllText("somefilename.txt", tmpCPText) ''save it to file
                writeCount += 1
                Label2.Text = writeCount.ToString()
                If CheckBox1.Checked Then
                    Beep()
                End If
            End If
        End If
    End Sub


End Class
link to executable (requires .net framework 4.0 or higher): h t t p : / / www. file dropper . com/autocpsave
 
Jotti Malware Scan

http://virusscan.jotti.org/en/scanre...5a2901f6051174
MD5: ee07a06e3fe8500b200ba3686e8a106d
SHA1: 93bc2eb02938dfe33e5e21160ea5df9ce1a424bd

^^ @ moderator, please upload to your file server or whatnot? I don't see "Reply with attachment" option, and wasn't going to start a new thread.

@OP, compile the source yourself..don't run the executable I posted until a moderator approves it.

Might not be the best solution, but should do what you're asking. ? Hopefully you're not copying hundreds of megs of text at a time..
thx but when I go to that link it just sends me back to the filledropper . com main page and it asks me to upload
Hmm..that was only a few days ago, no idea why the file would be gone already, but it seems you're right.
It's against the rules to post outside download links, so I'd really rather not..

PM a moderator and ask them the appropriate way for me to upload the file for you (create a new thread?!?).
Quote Originally Posted by abuckau907 View Post
Hmm..that was only a few days ago, no idea why the file would be gone already, but it seems you're right.
It's against the rules to post outside download links, so I'd really rather not..

PM a moderator and ask them the appropriate way for me to upload the file for you (create a new thread?!?).
ok I sent them a message
Quote Originally Posted by abuckau907 View Post
Hmm..that was only a few days ago, no idea why the file would be gone already, but it seems you're right.
It's against the rules to post outside download links, so I'd really rather not..

PM a moderator and ask them the appropriate way for me to upload the file for you (create a new thread?!?).
I think you just have to click on "Go Advanced" and then you will have an option to upload it.



[MPGH]NormenJaydenFBI :
"He can just upload the file in the thread."

Here is how it's done in C:

Code:
#include <cstdio>
#include <windows.h>

#pragma comment(lib, "USER32")

/*
        Auto copy-paster by Harava
              07.10.2014
*/

int main()
{
    HANDLE hClipData = NULL;
    HANDLE hLastClipData = NULL;
    long iClipSize = 0, iItemsSaved = 1;
    char * szClipData = NULL;
    char * szLastClipData = NULL;

    FILE * fOut = fopen("clipboard.txt", "a");
    if(fOut == NULL)
        return -1;

    while(!GetAsyncKeyState(VK_ESCAPE))
    {
        OpenClipboard(NULL);
        if(!IsClipboardFormatAvailable(CF_TEXT))
        {
            printf("Clipboard has something other than text!\n");
            CloseClipboard();
            Sleep(1000);
            continue;
        }
        hClipData = GetClipboardData(CF_TEXT);

        iClipSize = strlen((char*)hClipData);

        szClipData = (char*)malloc(iClipSize+1);
        memcpy(szClipData, (char*)hClipData, iClipSize+1);

        if(szLastClipData != NULL)
        {
            if(strcmp(szClipData, szLastClipData) != 0)
            {
                printf("Clipboard changed.\nSaving stuff to file.\n\n");
                fprintf(fOut, "**********     CLIPBOARD ITEM %d ( %d bytes )     **********\n\n", iItemsSaved, iClipSize);
                fwrite(szClipData, 1, iClipSize, fOut);
                fprintf(fOut, "\n\n**********     END OF ITEM %d     **********\n\n", iItemsSaved);
                fflush(fOut);
                iItemsSaved++;
            }
        }

        free(szLastClipData);
        szLastClipData = (char*)malloc(iClipSize+1);
        memcpy(szLastClipData, szClipData, iClipSize+1);

        free(szClipData);
        CloseClipboard();
        Sleep(100);
    }
    fclose(fOut);
    return 0;
}

Quote Originally Posted by Harava View Post

Here is how it's done in C:

Code:
#include <cstdio>
#include <windows.h>

#pragma comment(lib, "USER32")

/*
        Auto copy-paster by Harava
              07.10.2014
*/

int main()
{
    HANDLE hClipData = NULL;
    HANDLE hLastClipData = NULL;
    long iClipSize = 0, iItemsSaved = 1;
    char * szClipData = NULL;
    char * szLastClipData = NULL;

    FILE * fOut = fopen("clipboard.txt", "a");
    if(fOut == NULL)
        return -1;

    while(!GetAsyncKeyState(VK_ESCAPE))
    {
        OpenClipboard(NULL);
        if(!IsClipboardFormatAvailable(CF_TEXT))
        {
            printf("Clipboard has something other than text!\n");
            CloseClipboard();
            Sleep(1000);
            continue;
        }
        hClipData = GetClipboardData(CF_TEXT);

        iClipSize = strlen((char*)hClipData);

        szClipData = (char*)malloc(iClipSize+1);
        memcpy(szClipData, (char*)hClipData, iClipSize+1);

        if(szLastClipData != NULL)
        {
            if(strcmp(szClipData, szLastClipData) != 0)
            {
                printf("Clipboard changed.\nSaving stuff to file.\n\n");
                fprintf(fOut, "**********     CLIPBOARD ITEM %d ( %d bytes )     **********\n\n", iItemsSaved, iClipSize);
                fwrite(szClipData, 1, iClipSize, fOut);
                fprintf(fOut, "\n\n**********     END OF ITEM %d     **********\n\n", iItemsSaved);
                fflush(fOut);
                iItemsSaved++;
            }
        }

        free(szLastClipData);
        szLastClipData = (char*)malloc(iClipSize+1);
        memcpy(szLastClipData, szClipData, iClipSize+1);

        free(szClipData);
        CloseClipboard();
        Sleep(100);
    }
    fclose(fOut);
    return 0;
}

Thanks, but how do I save C filles and how do I compile them?

http://virusscan.jotti.org/en/scanre...f1743b242bf166

 
vb source


Code:
Public Class Form1
    Public oldCPText As String = ""
    Public writeCount As Long = 0
  
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        If Clipboard.ContainsText() Then
            Dim tmpCPText As String = Clipboard.GetText
            If tmpCPText <> oldCPText Then
                ''new text in clipboard
                oldCPText = tmpCPText
                System****.File.AppendAllText(My.Settings.outputFilename, tmpCPText & Environment.NewLine) ''save it to file
                writeCount += 1
                Label2.Text = writeCount.ToString()
                If CheckBox1.Checked Then
                    Beep()
                End If
            End If
        End If
    End Sub

    Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
        If e.KeyValue = Keys.F2 Then
            Dim userResponse As String = InputBox("Please enter the new output filename:", "somefilename.txt", "somefilename.txt")
            If userResponse.Length = 0 Then
                MsgBox("Invalid output file name. Name unchanged.")
            ElseIf userResponse.EndsWith(".txt") = False Then
                MsgBox("Invalid output file name. Must end in .txt. Name unchanged.")
            Else
                My.Settings.outputFilename = userResponse
                lblFilename.Text = "File: " & My.Settings.outputFilename
                MsgBox("Filename changed OK.")
            End If
        End If
    End Sub


    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        lblFilename.Text = "File: " & My.Settings.outputFilename
    End Sub
End Class



Microsoft Visual Studio (free versions available, basically fully featured) : http://www.microsoft.com/en-us/searc...tudio&from=DLC
is an option, if you want a full blown IDE (and the option to support multiple programming languages).
autoCpSave2_mpgh.net.rar8 KB · 2 downloads Clean
Posts 1–15 of 17 · Page 1 of 2

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us