AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

automatically copy the selected text

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
mighty-f



Joined: 12 Sep 2005
Posts: 213

PostPosted: Sat Feb 24, 2007 2:55 am    Post subject: automatically copy the selected text Reply with quote

I want to copy some text automatically when the selected test is leftmouse released.


for example, for the following sentence:---

The trial in the murder case is all set to begin from tomorrow

I select the whole sentence and then when i reach at the end of "tomorrow",
i release the left mouse button . I want a script such that the selected portion is automatically copied to the clipboard when i release the left mouse button.

Any script for this? Smile
Back to top
View user's profile Send private message Visit poster's website
Laszlo



Joined: 14 Feb 2005
Posts: 4015
Location: Pittsburgh

PostPosted: Sat Feb 24, 2007 3:14 am    Post subject: Reply with quote

here
Back to top
View user's profile Send private message
mighty-f



Joined: 12 Sep 2005
Posts: 213

PostPosted: Sat Feb 24, 2007 3:58 am    Post subject: Reply with quote

Hi I read that post and found it hard to realize.

Can you simply a bit?
Back to top
View user's profile Send private message Visit poster's website
Laszlo



Joined: 14 Feb 2005
Posts: 4015
Location: Pittsburgh

PostPosted: Sat Feb 24, 2007 4:13 am    Post subject: Reply with quote

Code:
~LButton::
   MouseGetPos x0, y0            ; save start mouse position
   KeyWait LButton
   MouseGetPos x, y              ; position when button released
   If (abs(x-x0) > 5 or abs(y-y0) > 5) {
      clip0 := ClipBoardAll      ; save old clipboard
      ClipBoard =
      Send ^c                    ; selection -> clipboard
      ClipWait 2, 1              ; restore clipboard if no data
      If ErrorLevel
         ClipBoard := clip0
   }
Return
Back to top
View user's profile Send private message
Candle



Joined: 19 Aug 2004
Posts: 334

PostPosted: Sat Feb 24, 2007 7:45 am    Post subject: Reply with quote

Nice Laszlo.
_________________
Autohotkey Just drives me crazy ..
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group