1

I am looking for a program that can copy any selected text to the clipboard automatically. E.g. if I select some text in Microsoft Word, it should automatically copy it to the clipboard. The Google Chrome extension Auto Copy 3.0.3 can do it in Google Chrome.

Ideally, it should support as many programs as possible. I'm interested for both Windows (Windows 7 SP1 x64 Ultimate) and Linux (Ubuntu 14.04 with KDE). Free is better but not compulsory.

  • 1
    It is already the case with Linux, you can paste selected text with a mousewheel click. – fxm Jul 15 '14 at 12:33
  • 1
    It is extremely unlikely that the same program would exist on both OSes to do this single task which is highly system-dependent. You should ask two separate questions. On Linux, what exactly are you after — selected text is automatically available as selection pasting (middle mouse wheel, keyboard shortcut in some programs), do you want it to be automatically copied to the clipboard (Ctrl+V in many programs)? – Gilles Jul 16 '14 at 20:08
  • I'm not a Linux user, but this (untrustable) website says Linux has this feature built in. Can you check if this is correct? All you need to do is select the text... is it correct? – ᔕᖺᘎᕊ Jul 20 '14 at 10:12
2

You can use AutoHotKey which is free, but unfortunately only for Windows :(:

The script (some clever guy from here has made it):

;Auto copy clipboard
~Lshift::
TimeButtonDown = %A_TickCount%
; Wait for it to be released
Loop
{
   Sleep 10
   GetKeyState, LshiftState, Lshift, P
   if LshiftState = U  ; Button has been released.
      break
   elapsed = %A_TickCount%
   elapsed -= %TimeButtonDown%
   if elapsed > 200  ; Button was held down long enough
   {
      x0 = A_CaretX
      y0 = A_CaretY
      Loop
   {
     Sleep 20                    ; yield time to others
     GetKeyState keystate, Lshift
     IfEqual keystate, U, {
       x = A_CaretX
       y = A_CaretY
       break
     }
   }
   if (x-x0 > 5 or x-x0 < -5 or y-y0 > 5 or y-y0 < -5)
   {                             ; Caret has moved
      clip0 := ClipBoardAll      ; save old clipboard
      ;ClipBoard =
      Send ^c                    ; selection -> clipboard
      ClipWait 1, 1              ; restore clipboard if no data
      IfEqual ClipBoard,, SetEnv ClipBoard, %clip0%
   }
      return
   }
}

~LButton::
MouseGetPos, xx
TimeButtonDown = %A_TickCount%
; Wait for it to be released
Loop
{
   Sleep 10
   GetKeyState, LButtonState, LButton, P
   if LButtonState = U  ; Button has been released.
   {
      If WinActive("Crimson Editor") and (xx < 25) ; Single Click in the Selection Area of CE
      {
         Send, ^c
         return
      }
      break
   }
   elapsed = %A_TickCount%
   elapsed -= %TimeButtonDown%
   if elapsed > 200  ; Button was held down too long, so assume it's not a double-click.
   {
      MouseGetPos x0, y0            ; save start mouse position
      Loop
   {
     Sleep 20                    ; yield time to others
     GetKeyState keystate, LButton
     IfEqual keystate, U, {
       MouseGetPos x, y          ; position when button released
       break
     }
   }
   if (x-x0 > 5 or x-x0 < -5 or y-y0 > 5 or y-y0 < -5)
   {                             ; mouse has moved
      clip0 := ClipBoardAll      ; save old clipboard
      ;ClipBoard =
      Send ^c                    ; selection -> clipboard
      ClipWait 1, 1              ; restore clipboard if no data
      IfEqual ClipBoard,, SetEnv ClipBoard, %clip0%
   }
      return
   }
}
; Otherwise, button was released quickly enough.  Wait to see if it's a double-click:
TimeButtonUp = %A_TickCount%
Loop
{
   Sleep 10
   GetKeyState, LButtonState, LButton, P
   if LButtonState = D  ; Button has been pressed down again.
      break
   elapsed = %A_TickCount%
   elapsed -= %TimeButtonUp%
   if elapsed > 350  ; No click has occurred within the allowed time, so assume it's not a double-click.
      return
}

;Button pressed down again, it's at least a double-click
TimeButtonUp2 = %A_TickCount%
Loop
{
   Sleep 10
   GetKeyState, LButtonState2, LButton, P
   if LButtonState2 = U  ; Button has been released a 2nd time, let's see if it's a tripple-click.
      break
}
;Button released a 2nd time
TimeButtonUp3 = %A_TickCount%
Loop
{
   Sleep 10
   GetKeyState, LButtonState3, LButton, P
   if LButtonState3 = D  ; Button has been pressed down a 3rd time.
      break
   elapsed = %A_TickCount%
   elapsed -= %TimeButtonUp%
   if elapsed > 350  ; No click has occurred within the allowed time, so assume it's not a tripple-click.
   {  ;Double-click
      Send, ^c
      return
   }
}
;Tripple-click:
   Sleep, 100
   Send, ^c
return

~^a::Send, ^c ;Ctl+A = Select All, then Copy

For it to work, the text must be selected by:

  • Shift and arrow keys,
  • Left mouse button, or
  • Double click, or
  • Triple click, or
  • Ctrl+A

It works great! All you need to do is select the text, and it is already there in your clipboard! AutoHotKey works throughout the OS afaik.

  • Can you modify it so that we can paste with a mouse middle button click ? – iMath Nov 6 '15 at 9:08
1

You can use Diodon on Ubuntu. Type these commands one by one in the Terminal. Enter your password when prompted:

sudo add-apt-repository ppa:diodon-team/stable

sudo apt-get update

sudo apt-get install diodon
  • 5
    What does diodon do? – Gilles Jul 16 '14 at 20:07
0

I would recommend Parcellite for Linux. It should be already in Ubuntu repos.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.