What it does: copies something from a window and pastes to another, leaving the Clipboard untouched, an the user making 2 moves in total (1 hotkey + 1 click).
For best results please assign to a hotkey of your choise.
The script was made using only AHK recources.
Probably the idea has been already implemented. Suggestions welcome as always.
Code:
SetBatchLines, 10ms
WinGetActiveTitle, ActiveWinTitle ; Retrieve active window title
clipsaved := clipboard ; Leave Clipboard untouched
clipboard = ; Empty clipboard
Sleep, 100 ; Increase reliability
Send, ^c
Sleep, 100
if (!clipboard) ; If clipboard is empty
{
MsgBox, Nothing has been selected/copied.
clipboard := clipsaved ; Restore Clipboard
clipsaved = ; Unblock memory
Return
}
Winget, AllWins, list ; Retrieve all open windows' IDs
Loop, %AllWins%
{
Wingettitle, WinTitle, % "ahk_id " AllWins%A_Index%
WinTitle%A_Index% = %WinTitle% ; Store win titles in array
}
WinCount = 0
Gui Font, s8, Tahoma
Gui Margin, 9,5
Loop %AllWins% ; List win titles in a GUI
{
If WinTitle%A_Index% in ,Program Manager,%ActiveWinTitle%
Continue ; Exclude no-name, Program manager and initial window
But := WinCount + 1
Gui Add, Text, x5 gexec, % WinTitle%A_Index%
Gui Add, Button, w0 h0 gExec, % WinTitle%A_Index%
WinCount++
}
if (!WinCount) ; If no other window is open
{
MsgBox, No window exists but the one you are working on.
clipboard = clipsaved ; Restore Clipboard
clipsaved = ; Unblock memory
Return
}
Gui, Show, , Quick Copy From Window to Window ...
; Resize/reposition window if too small
WinGetPos, , , WW, , Quick Copy From Window to Window ...
if (WW<300)
{
sysget, Mon, Monitorworkarea
scwidth := MonRight - MonLeft
WinMove, Quick Copy From Window to Window ..., , (scwidth/2)-(150), , 300
}
hCurs:=DllCall("LoadCursor","UInt",NULL,"Int",32649,"UInt")
OnMessage(0x200,"WM_MOUSEMOVE")
Return
; ------- END OF AUTOEXECUTE SECTION
Exec:
WinActivate, %A_GuiControl% ; Activate target win
Send, ^v ; Paste on target win
clipboard := clipsaved ; Restore Clipboard
ExitApp
Return
GuiEscape: ; Dismiss on 'Esc'
GuiClose:
Exitapp
Return
WM_MOUSEMOVE(wParam,lParam) ; Function for 'hand' cursor
{
IfWinActive, Quick Copy From Window to Window ...
{
Global hCurs
MouseGetPos,,,,ctrl
ifinstring, ctrl, Static
DllCall("SetCursor","UInt",hCurs)
}
Return
}