So here is a another try.
Its a more advanced version. Now it works in Excel and you can determine a delimiter between the textsnippets.
In short: CopyCollector puts copied text into a buffer just by clicking the appskey in one window. by changing the window the same key try to insert the text:
.
Code: Select all
#SingleInstance ignore
SetTitleMatchMode, 2
copyAWindow:="a window with forms"
help =
(
CopyCollector collect marked text with the appskey.
by changing the window the same appskey will try to insert the whole collected snippets.
it works in most windows par example in Excel or firefox.
You can give him a special window where it works a little bit different.
In the CopyAWindow it acts like Ctrl-A when selecting Text. This is very useful foer copying from form.
You only need to put the caret into the form (simply click) and then use the appskey to collect the content.
In the Taskbar you can set a delimiter between the textsnippets
)
Tiptext =
(
multiple copy of marked text in one window
and insert the whole bunch in another window.
)
menutitle:="CopyCollector HK:Appskey"
Menu, tray,add, info
Menu, tray,Disable, info
Menu, tray,Rename, info , %menutitle%
Menu, tray, add
Menu, Tray, Tip, %Tiptext%
Menu, tray, add, help
Menu, tray, add
Menu, tray,add, delimiter
Menu, tray,Disable, delimiter
Menu, tray, add
Menu, tray, add, space
Menu, tray, add, paragraph
Menu, tray, Check, paragraph
Menu, tray, add, colon
Menu, tray, add, Semicolon
Menu, tray, add
Menu, tray, add, Exit
Menu, tray, NoStandard
separator:="`n"
Appskey::CopyCollection(copyAWindow,separator)
return
CopyCollection(copyAWindow,separator)
{
; copies selectect text to a var as long as you remain in the same window.
; if you change the window the function tries to insert the collected textsnippets.
static oldID:=0 , Collection :=""
id:=WinExist("A")
if ((id <> oldID) and oldID)
{
Clipboard:=""
; ----
;only insert the text - nothing will be replaced
send ^c
sleep,10
if (Clipboard<>"")
{
Collection:=""
oldID:=0
id:=""
Clipboard:=""
return
}
;----
if (A_ThisMenuItem<>"space")
collection:=trim(collection)
Clipboard:=SubStr(collection,1, StrLen(collection)-1)
send ^v
sleep, 10
Collection:=""
oldID:=0
id:=""
Clipboard:=""
return
}
if WinActive("ahk_class XLMAIN")
{
send ^c
clipwait,10
Clipboard:=trimplus(Clipboard)
}
else If (WinActive(copyAWindow) and (copyAWindow<>""))
{
send ^c{Right}
if (Clipboard="")
send ^a^c{Right}
}
else
send ^c{Right}
ClipWait ,2
Collection .= trim(Clipboard) . separator
sleep, 10
Clipboard:=""
oldID:=id
id:=""
return
}
help:
Msgbox, %help%
return
Exit:
exitapp
paragraph:
separator:="`n"
Menu, tray, Check, paragraph
Menu, tray, Uncheck, colon
Menu, tray, Uncheck, space
Menu, tray, Uncheck, semicolon
return
Space:
separator:=A_Space
Menu, tray, Uncheck, paragraph
Menu, tray, Uncheck, colon
Menu, tray, Check, space
Menu, tray, Uncheck, semicolon
return
colon:
separator:="`, "
Menu, tray, Uncheck, paragraph
Menu, tray, Check, colon
Menu, tray, Uncheck, space
Menu, tray, Uncheck, semicolon
return
semicolon:
separator:="`; "
Menu, tray, Uncheck, paragraph
Menu, tray, Uncheck, colon
Menu, tray, Uncheck, space
Menu, tray, Check, semicolon
return
info:
return
delimiter:
return
TrimPlus(Text,NoTrim ="")
{
p:=",;:."
s:="`t,`n,`r,`v,`f, "
Loop,Parse,NoTrim
{
p:=strReplace(p,A_LoopField)
s:=strReplace(s,A_LoopField)
}
Loop,Parse,p
Text:=strReplace(Text,A_LoopField,A_LoopField . A_Space)
Loop,Parse,s,`,
{
empty:=A_LoopField
Loop
Text:=strReplace(Text,empty,A_Space,OutputVarCount)
until !OutputVarCount
}
Loop,Parse,p
Text:=strReplace(Text,A_Space . A_LoopField,A_LoopField)
Text:= trim(Text)
return Text
}
;SendMessage, 0xB1,p1 ,p2 ,, ahk_id %hEdit% ;setsel