Created
May 12, 2023 19:10
-
-
Save JoeGlines/36d570a8714a457d244448c2e734febc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Clipboard_Backup_Copy_Selected_Text() | |
StringUpper, Clipboard,Clipboard ;uppercase all | |
Sort, Clipboard, U CL ;sort, case insensitive, remove duplicates | |
Clipboard:=Remove_Blank_Lines(clipboard) | |
Clipboard := RegExReplace(Clipboard,"m)^[_\s]*|[_\s]*$") ;removes spaces at beginning and end | |
Clipboard_Paste_and_Restore_Clipboard(Clipboard_Backup) | |
return | |
;***********Remove Blank lines******************* | |
Remove_Blank_Lines(text){ | |
Loop,parse,text,`n`r ;loops through lines | |
{ | |
New:=RegExReplace(A_LoopField,"^\s?$","") ;if line only has white space | |
If (new!="") | |
NewText.=new "`r`n" | |
} | |
return :=NewText | |
} | |
;******for clipboard manipulation and restoring original clipboard********************************* | |
Clipboard_Backup_Copy_Selected_Text(){ | |
ClipBack := Clipboard ;Store full version of Clipboard | |
clipboard = ; Empty the clipboard | |
SendInput, ^c | |
ClipWait, 1 | |
If ErrorLevel { ;Added errorLevel checking | |
Clipboard:=ClipBack ;Restore Clipboard | |
MsgBox, No text was sent to clipboard | |
Return | |
} | |
Return ClipBack | |
} | |
;**********************Paste and Restore clipboard********************************* | |
Clipboard_Paste_and_Restore_Clipboard(Clipboard_Backup,SleepTime="600"){ | |
Send ,^v | |
sleep, %SleepTime% | |
Clipboard:=Clipboard_Backup | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment