+^r::
AddTextEditWidth:=400
Gui,Add,Text
Gui,Add,Text,xm,Which operation to you want to performed?
Gui,Add,Radio,Checked vWhichOp xm,Retain
Gui,Add,Radio,x+20,Remove
Gui,Add,Text
Gui,Add,Text,xm,Enter the string related to retain or remove operation (or click Cancel not to add text):
Gui,Add,Edit,vAddTextRetainRemove xm w%AddTextEditWidth%
Gui,Add,Text
Gui,Add,Button,xm gButtonAddTextRetainRemoveOK Default,&OK
Gui,Add,Button,x+10 gButtonAddTextRetainRemoveCancel,&Cancel
Gui,Show,,Add text
Return
ButtonAddTextRetainRemoveOK:
Gui,Submit
Gui,Destroy
Send, ^c
ClipWait,1
If (ErrorLevel=1)
{
MsgBox,4144,Error,No text appeared on clipboard after initial Ctrl+c and waiting for one second
Return
}
Else
ReferenceString:=AddTextRetainRemove
NewClipboardVar:=""
Loop,Parse,Clipboard,`n,`r
If (WhichOp=1)
{
If InStr(A_LoopField, ReferenceString)
NewClipboardVar:=NewClipboardVar . A_LoopField . "`n"
}
Else
{
If InStr(A_LoopField, ReferenceString)
Continue
NewClipboardVar:=NewClipboardVar . A_LoopField . "`n"
}
LastChar:=SubStr(NewClipboard,0,1) ; see if last char is CR or LF
If ((LastChar="`r") or (LastChar="`n"))
{
StringTrimRight,NewClipboard,NewClipboard,1 ; last char is CR or LF - remove it
LastChar:=SubStr(NewClipboard,0,1) ; see if new last char is CR or LF
If ((LastChar="`r") or (LastChar="`n")) ;
StringTrimRight,NewClipboard,NewClipboard,1 ; new last char is CR or LF - remove it
}
Clipboard:=NewClipboardVar
ClipWait,2
If (ErrorLevel=1)
MsgBox,4144,Error,No text appeared on clipboard with blank lines removed after waiting for two seconds`nThis should never happen
Else
Send ^v
ButtonAddTextRetainRemoveCancel:
Gui,Destroy
Return
Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.
When asked, what has been your best career decision?
Deciding to stick with EE.
Being involved with EE helped me to grow personally and professionally.
Connect with Certified Experts to gain insight and support on specific technology challenges including:
We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE