Edit string in clipboard


  1. Posts : 11
    Windows 10 Pro 64-bit
       #1

    Edit string in clipboard


    Is there any software that can automatically edit a string in the Windows clipboard e.g. be programmed to remove "- " in the string before it is pasted? (Windows 10.0.10492)
      My Computer


  2. Posts : 3,104
    Win10
       #2

    If all you want to do is replace the minus-dash signs in text strings, have a look at Autohotkey, which amongst many things might possibly do what you want.

    AutoHotkey

    For eg. the following script, which I have modified from the Superuser link shown, can allow you to copy Strings/Text as you normally do using Ctrl+c , and if you use its hotkey, which is Ctrl+Alt+c , then it can copy a modified String/Text with all "-" signs/characters removed.

    RegexClipboard.ahk
    Code:
    ; To replace dash [-] with a space " " in copied strings
    ; ie replace any and all - (dashes) with  space/s
    ; possible uses for the RegExReplace command - replace any of these characters \? <>/\\\*""|:-
    ; "Ctrl+Alt+c" is the hotkey when Strings need to be modified
    ; "Ctrl+v"     hotkey for PASTE remains unchanged
    ; "Ctrl+c"     will still remain as hotkey for unmodified Strings and other objects such as files images etc
    ; Clipboard History can show both modified & unmodified strings
    SendMode Input
    
    ; "Ctrl+Alt+c" is the hotkey
    
    ^!c::
    Send ^c
    ClipWait
    sleep 250
    OldClip := clipboard
    clipboard = %oldClip%
    NewClip := RegExReplace(clipboard, "[-]", " ")
    sleep 250
    clipboard = %NewClip%
    ClipWait
    ;msgbox, old clip:---`n%OldClip%
    ;msgbox, new clip:---`n%clipboard%
    sleep 250
    return
    
    ; modified from
    ; reference JinSnow
    ; page      https://superuser.com/questions/351993/automatically-strip-invalid-characters-from-windows-filenames
    In addition, if you are using the Windows "Clipboard History", hopefully it will show both the original strings and the modified Strings as they are copied to the Clipboard.

    Edit string in clipboard-regexclipboard_ahk.jpg

    Only thing is you would need to read up on Autohotkey, to gain some understanding of how ti works.
      My Computers


  3. Posts : 11
    Windows 10 Pro 64-bit
    Thread Starter
       #3

    Edit string in clipboard


    Many thanks - this is very helpful.
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd
All times are GMT -5. The time now is 17:31.
Find Us




Windows 10 Forums