Windows 10 Clipboard Text Editing

Automatically Editing Text on Windows 10 Clipboard

Introducing a program to automatically edit text on the Windows 10 clipboard. It uses a sqlite database file generated from a clipboard manager called ditto. So please install it...

Shou Arisaka
2 min read
Nov 15, 2025

Introducing a program to automatically edit text on the Windows 10 clipboard.

Another ditto article.

This function uses a sqlite database file generated from a clipboard manager called ditto. So please install it.

Ditto download | SourceForge.net

Please use the following bash script.


modifyWindowsClipboardText(){

while [ true ];
do

cp /mnt/c/Users/user/AppData/Roaming/Ditto/Ditto.db $TMPDIR/modifyWindowsClipboardText_Ditto.db

WindowsClipboardTextById="$(sqlite3 $TMPDIR/modifyWindowsClipboardText_Ditto.db "$(cat <<'EOT'
SELECT mText from Main
order by lDate desc
LIMIT 1 OFFSET 0
EOT
)")"

[[ "${WindowsClipboardTextById}" =~ ^https:\/\/user.xsrv.jp\/images\/ss\/ShareX_ScreenShot_.*\.(png|jpg|gif|mp4)$ ]] && {
  echo "${WindowsClipboardTextById}" | sed -Ee "s/(.*)/!\[\1\]\(\1\)/g" | clip.exe ;
  printf "Modified the Windows clipboard. : sharexUrl" ;
  sleep 2s ; continue ;
} || {
  : ;
}

echo -ne "$(isodate)\tNothing updated on the clipboard.\033[0K\r"

sleep 2s

done

}

isodate ()
{
    date +%FT%T%Z
}

What I’m doing is, I use sharex, and when I take a screenshot, the URL is automatically copied to the clipboard. I usually share this URL with friends or paste it into article text, but at this time there’s the hassle of editing it to Markdown format from the text editor. Well, it’s something that can be done in about 5 seconds. I’m automating the work of replacing this URL with Markdown.

  1. Get the latest clipboard text (unique one) from the database
  2. If the text data matches a regular expression, process it accordingly and copy it to the clipboard
Since I'm processing only unique text data that was registered in the database for the first time, for example, even if you copy the text data `https://user.xsrv.jp/images/ss/ShareX_ScreenShot_51c9ea5f-a16e-44ce-9469-1d313ced642a.png` to the clipboard again, the same processing will not be done again.

If you want to use it as a URL, you can copy the URL that’s second from ctrl + +. If you want to use Markdown, just paste the first one.

That’s what I’m doing.

Share this article

Shou Arisaka Nov 15, 2025

🔗 Copy Links