Hi I use the following hotkeys to copy text from any editor, process it using one of the many routines and then paste it back. In all these routines, only one line is different. how can i reduce lines and optimise code? thanks
Code:
; work in any editor
^+F9::
Send ^a ; select all
Sleep, 250 ; this improves reliability
Clipboard = ; start off with blank clipboard to improve reliability
Send ^c ; copy the full contents of the editor
ClipWait, 2 ; wait for clipboard to contain text
Clipboard := process1(Clipboard)
Send ^v ; paste the processed data
Sleep, 250 ; give time to paste before emptying clipboard
Clipboard = ; empty the clipboard after use
Return
^+F10::
Send ^a ; select all
Sleep, 250 ; this improves reliability
Clipboard = ; start off with blank clipboard to improve reliability
Send ^c ; copy the full contents of the editor
ClipWait, 2 ; wait for clipboard to contain text
Clipboard := process2(Clipboard)
Send ^v ; paste the processed data
Sleep, 250 ; give time to paste before emptying clipboard
Clipboard = ; empty the clipboard immediately after use
Return
^+F11::
Send ^a ; select all
Sleep, 250 ; this improves reliability
Clipboard = ; start off with blank clipboard to improve reliability
Send ^c ; copy the full contents of the editor
ClipWait, 2 ; wait for clipboard to contain text
Clipboard := process3(Clipboard)
Send ^v ; paste the processed data
Sleep, 250 ; give time to paste before emptying clipboard
Clipboard = ; empty the clipboard immediately after use
Return
Only the red part is different in these three routines. how can i condense code?