multiple copy/paste

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
cynflux
Posts: 6
Joined: 02 Nov 2015, 12:40

multiple copy/paste

25 Jun 2018, 05:05

Hello,

I'd like to be able to copy 2 items and paste them in the following script (first copied item as %clipboard% and second copied item as another variable name like %clipboard2%)

Code: Select all

:OC:tpu::
SetKeyDelay, 0
Send Called
Send {Space}
SendInput %clipboard%
Send {Space}
Send and spoke with 
Send {Space}
SendInput %clipboard2% and advised that we have picked up their ticket.
Return
Is there a way to do this?
Thank you in advance.
Qysh
Posts: 143
Joined: 24 Apr 2018, 09:16

Re: multiple copy/paste

25 Jun 2018, 13:12

Alt+C to copy to the second Clipboard
Alt+V to paste the second Clipboard
F6 to send your formated Text

Code: Select all


Clipboard2 = %Clipboard%

!C::
Clipboardtemp = %Clipboard%
Send, ^{c}
Clipboard2 = %Clipboard%
Clipboard = %Clipboardtemp%
return

!V::
Clipboardtemp = %Clipboard%
Clipboard = %Clipboard2%
Send, ^{v}
Clipboard = %Clipboardtemp%
return

F6::
Clipboardtemp = %Clipboard%
Clipboard = Called %Clipboard% and spoke with %Clipboard2% and advised that we have picked up their ticket.
Send, ^{v}
Clipboard = %Clipboardtemp%
return
burque505
Posts: 1736
Joined: 22 Jan 2017, 19:37

Re: multiple copy/paste

25 Jun 2018, 13:40

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
;**************************
; Just Ctrl-C for the first clip, Alt-C for the second clip
; Then your hotstring

!C::
first := Clipboard
Clipboard =
Send, ^{c}
ClipWait
second := Clipboard
Clipboard =
return

:O*C:tpu::
Clipboard = Called %first% and spoke with %second% and advised that we have picked up their ticket.
Send, ^{v}
return

Escape::ExitApp
EDIT: I overedited this without checking, now it isn't working, I'll post it when I undo my mistakes. Thanks.
Fixed.
2clips3.gif
2clips3.gif (23.98 KiB) Viewed 4077 times
Regards,
burque505
aalim
Posts: 1
Joined: 20 Jul 2020, 02:40

Re: multiple copy/paste

14 Aug 2020, 20:20

Hi there. how would the code go if there are 4 words to copy and paste? tried modifying the code, but only 3 words get pasted. cheers. thanks :)
User avatar
rommmcek
Posts: 1478
Joined: 15 Aug 2014, 15:18

Re: multiple copy/paste

19 Sep 2020, 17:57

Try:

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

Clp:= []
Return

+^c:: ; add marked text to custom "clipboard"
    Clipboard:= ""
    Send, ^c
    ClipWait, 1
    Clp.Push(Clipboard)
Return

^Del:: Clp.RemoveAt(Clp.Length()) ; delete last "clipboard"
+^Del:: Clp:= [] ; delete all "clipboards"

F6:: ; display all "clipboards"
    cl:= ""
    for i, j in Clp
        cl.= i ": " j "`n"
    MsgBox % cl
Return

+^v:: ; paste the "sentence" with "clipboards"
    Clipboard:= "aaa " Clp.1 " bbb " Clp.2 " ccc " Clp.3 " ddd " Clp.4 " eee " Clp.5 ; ....
    Send, ^v
Return

+^Esc:: ExitApp ; exit applicaton

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], haomingchen1998, ntepa and 151 guests