Jump to content

AutoCP 1.0


fmen
 Share

Recommended Posts

#cs
                                       AutoCP 1.0  by fmen. 

This code comes from example scripts and the kind help from
this forum. I have been using this simple program for months now
and it has saved me thousands of clicks. I hope you find it helpful too. Any 
tweaks or suggestions would be appreciated.

Q: What is AutoCP 1.0

A: AutoCP stands for AutIt Copy-Paste. It is similar to Firefox's 
   addon, AutoCopy, except that AutoCP works in all Window applications.
--------------------------------------------------------------

Q: What does AutoCP actually do?

A: AutoCP copies selected text to the clipboard when using 
   the LEFT mouse button click-dragging method. It is similar to what 
   happens in Linux or mIRC. Furthermore, clicking the MIDDLE mouse 
   button will paste the clipboard contents back to any text field 
   you choose.
--------------------------------------------------------------

Q: Why do I need this program?

A: You may or may not find it useful. For those of you who hate extra 
   clicks, it is a terrific time saver. That's pretty much the benefit. 
--------------------------------------------------------------

Q: The biggest problem with auto-copying applications when working 
   in any text-editor (notepad, Word, email applications,  etc), is 
   that sometimes you want to highlight words and phrases in order to 
   delete or paste over them rather than to copy them. How does AutoCP
   handle this dilemma?

A: Excellent question! Trying to copy selected text from the clipboard 
   over other text is indeed a problem that Linux, Mirc, AutoCopy etc 
   have not been able to solve (As far as I know). AutoCP has a built 
   in function that disables the copy function any time you wish.
------------------------------------------------------------

Q: How do you temporararily disable the copy function?

A: Press the <CTRL> key when highlighting text and it will NOT copy to 
the clipboard. Click the MIDDLE mouse button to paste the clipboard 
contents over the highlighted text.
------------------------------------------------------------

Q: Is there anything else I need to know?

A: 1) There is a built in delay of 0.5 seconds between pressing 
   the LEFT mouse button and when copying begins. This is necessary 
   in order to avoid activating AutoCP with every LEFT mouse click. 
   Therefore you should keep the mouse button down for more than 
   half a second in order to highlight and copy text. This happens 
   in the background and is generally not of any concern to the user.
   A quick double-click of a word will highlight it but not copy it.
   2) <Ctrl><Shift>q = quits program
   3) Tooltip tells you when something is copied.
#ce



#include <Misc.au3>
#include <Constants.au3>

$dll = DllOpen("user32.dll")
HotKeySet("^+q", "Quit") 

While 1
    If _IsPressed('01', $dll)Then Call ("Copy"); Left Copies
    If _IsPressed('04', $dll)Then Call ("Paste"); Mid Paste     
    Sleep(10)
WEnd



;----------------------------Functions------------------------------------------------

Func Copy()
    $timer = TimerInit()
    Do 
     Until Not _IsPressed('01', $dll)
     $dif = TimerDiff($timer)
     If Not _IsPressed(11) And $dif>500 Then 
        Send("^c")
        ToolTip("Copied", 1200, 1000)
        Sleep(800)
        ToolTip("")
    EndIf   
EndFunc

Func Paste()
    Do
         Sleep(10)
     Until Not _IsPressed('04', $dll)  
     Send("^v")
EndFunc
    
Func Quit()
    Exit 0
EndFunc 

;-----------------------------------------------------

I corrected the paste function. I inadvertently left out the ^v. Not that anyone noticed it was non-functional. LOL.

Edited by fmen
Link to comment
Share on other sites

  • 3 weeks later...

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