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 

Multiple copy and paste tool

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





PostPosted: Fri Dec 28, 2007 12:00 pm    Post subject: Multiple copy and paste tool Reply with quote

Hi,
I am doing a copy and paste job. I have several different paragraph of text to copy and paste. But each time I don't know what to paste until the very last. What I need is just like the function that excel has provided to choose the content to paste. So I got an idea from the way in starcraft to asign a team to a number. I want to use ctrl + 1 to copy text into slot 1 and use alt + 1 to paste the content in slot 1. and 2 and other numbers. I searched the forum but didn't find a script like that. Maybe it's because I am not familiar with here. Finally I tried to write one myself. The script is like below.

Code:

^1::
Send ^c
ClipWait
Clip1 := ClipBoard
return
!1::
ClipBoard := Clip1
Send ^v
return

^2::
Send ^c
ClipWait
Clip2 := ClipBoard
return
!2::
ClipBoard := Clip2
Send ^v
return

^3::
Send ^c
ClipWait
Clip3 := ClipBoard
return
!3::
ClipBoard := Clip3
Send ^v
return

^4::
Send ^c
ClipWait
Clip4 := ClipBoard
return
!4::
ClipBoard := Clip4
Send ^v
return

^5::
Send ^c
ClipWait
Clip5 := ClipBoard
return
!5::
ClipBoard := Clip5
Send ^v
return

^6::
Send ^c
ClipWait
Clip6 := ClipBoard
return
!6::
ClipBoard := Clip6
Send ^v
return

^7::
Send ^c
ClipWait
Clip7 := ClipBoard
return
!7::
ClipBoard := Clip7
Send ^v
return

^8::
Send ^c
ClipWait
Clip8 := ClipBoard
return
!8::
ClipBoard := Clip8
Send ^v
return

^9::
Send ^c
ClipWait
Clip9 := ClipBoard
return
!9::
ClipBoard := Clip9
Send ^v
return

^0::
Send ^c
ClipWait
Clip0 := ClipBoard
return
!0::
ClipBoard := Clip0
Send ^v
return


It works pretty good for text.
My question is that how to apply this if not only text?

I tried ClipBoardAll but it did not work.

Can anybody tell me how to copy multi pictures or others?
Back to top
engunneer



Joined: 30 Aug 2005
Posts: 6847
Location: Pacific Northwest, US

PostPosted: Fri Dec 28, 2007 2:25 pm    Post subject: Reply with quote

ClipboardAll should do it, how did you use it? (It should only be used when capturing the clipboard, not when refilling it from the script.)

related topics:
Auto Copy Selected Text to Clipboard
ClipStep - Step through multiple clipboards using Ctrl-X-C-V
Preview of a Clipboard Helper (CH)
Script with handy clipboard board functions


also,
CLCL - Clipboard extender
http://www.nakka.com/soft/index_eng.html
(from http://www.autohotkey.com/forum/viewtopic.php?t=25463)
_________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM
Back to top
View user's profile Send private message Visit poster's website
wooing
Guest





PostPosted: Sat Dec 29, 2007 1:08 am    Post subject: Reply with quote

dear engunneer,

Thank you very much for such a detailed reply. I think I've got what I need. But I just want to ask the question technically about ClipBoardAll. I changed my script to the code below. It also works well with plain text. But when I open a picture with mspaint. I select one area and press Ctrl + 1 and I select another area and press Ctrl + 2. After that I press Alt + 1, nothing happens. It will be appreciated if you can tell me how to use ClipBoardAll here.

Code:

^1::
Send ^c
ClipWait
Clip1 := ClipBoardAll
return
!1::
ClipBoard := Clip1
Send ^v
return

^2::
Send ^c
ClipWait
Clip2 := ClipBoardAll
return
!2::
ClipBoard := Clip2
Send ^v
return

^3::
Send ^c
ClipWait
Clip3 := ClipBoardAll
return
!3::
ClipBoard := Clip3
Send ^v
return

^4::
Send ^c
ClipWait
Clip4 := ClipBoardAll
return
!4::
ClipBoard := Clip4
Send ^v
return

^5::
Send ^c
ClipWait
Clip5 := ClipBoardAll
return
!5::
ClipBoard := Clip5
Send ^v
return

^6::
Send ^c
ClipWait
Clip6 := ClipBoardAll
return
!6::
ClipBoard := Clip6
Send ^v
return

^7::
Send ^c
ClipWait
Clip7 := ClipBoardAll
return
!7::
ClipBoard := Clip7
Send ^v
return

^8::
Send ^c
ClipWait
Clip8 := ClipBoardAll
return
!8::
ClipBoard := Clip8
Send ^v
return

^9::
Send ^c
ClipWait
Clip9 := ClipBoardAll
return
!9::
ClipBoard := Clip9
Send ^v
return

^0::
Send ^c
ClipWait
Clip0 := ClipBoardAll
return
!0::
ClipBoard := Clip0
Send ^v
return
Back to top
[VxE]



Joined: 07 Oct 2006
Posts: 1500

PostPosted: Sat Dec 29, 2007 2:52 am    Post subject: Reply with quote

Code:
ClipKeys = 1234567890
Loop Parse, ClipKeys
   Hotkey, ^%a_LoopField%, ClipKeyLabel
Loop Parse, ClipKeys
   Hotkey, !%a_LoopField%, ClipKeyLabel
return
ClipKeyLabel:
StringRight, ClipNN, a_ThisHotkey, 1
Clipboard := Clip%ClipNN%
KeyWait, Alt
Send % ( InStr( a_ThisHotkey, "^" ) ? "{blind}c" : ( ( InStr( a_ThisHotkey, "!" ) && ( clipboard := clip%clipnn% )) ? "{blind}^v" : "" ) )
ClipWait, 1, 1
Clip%clipNN% := ClipBoardAll
return

Tested. But you have to release the alt key after hitting a nunmber in order to paste (I'm sure you don't mind that, right?)

One likely reason your script was having trouble pasting in MSPaint may be because you were still holding the [alt] key when the script was trying to send ^v. My script works around that with KeWait.
_________________
My Home Thread
More Common Answers: [1]. It's in the FAQ [2]. Ternary ( a ? b : c ) guide [3]. Post code inside [code][/code] tags !
Back to top
View user's profile Send private message
ManaUser



Joined: 24 May 2007
Posts: 906

PostPosted: Sat Dec 29, 2007 3:16 am    Post subject: Reply with quote

Almost there. Smile

Just two problems left. First, ClipWait normally looks only for text data. So with if you copy an image instead it just keeps waiting. We can change that by giving it a 1 as the second argument. (The first argument is max time to wait, which I left blank). Second, you need to clear the clipboard before using ClipWait or it may just detect what was already in there. So:

Code:
^1::
ClipBoard =
Send ^c
ClipWait, , 1
Clip1 := ClipBoardAll
return
!1::
ClipBoard := Clip1
Send ^v
return
Back to top
View user's profile Send private message
tazmanian



Joined: 17 Nov 2007
Posts: 16

PostPosted: Sat Dec 29, 2007 7:36 pm    Post subject: Ditto Reply with quote

Hi,

Check out Ditto which is absolutely brilliant. IMHO it is the best clipboard utility that exists for Windows. You can set it to store EVERYTHING you copy and paste (although I set it to store 100 clips). You can even search the things you have copied.

What is more its open source, so if you know C++ you can extend it (but it has everything anyway):

http://ditto-cp.sourceforge.net/
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