Ditto icon indicating copy to clipboard operation
Ditto copied to clipboard

Restore Windows Clipboard After Ditto Paste

Open ariefcfa opened this issue 1 year ago • 6 comments

Is it possible to restore Windows Clipboard after Ditto paste?

I've tried but failed, with:

  • paste script: (i'm not a programmer)
var oldString = clip.GetAsciiString();
return false;
clip.SetAsciiString(oldstring);
return false;
  • clipboard buffer, i dont understand how. currently i found this not appear in Ditto clipboard list

please kindly help.


Ditto version: Latest portable (03.24.246.00 64bit) OS: Windows 10

ariefcfa avatar Jan 05 '24 12:01 ariefcfa

Welcome. Can you please tell me more details? What do you want to restore from?

To help you understand, let me explain a little bit about how Ditto works. First if you do copy action(by Ctrl+C as naturally) Ditto catch it and save to own DB.

After, if you do paste action(by Ctrl+V as naturally, Don't mind Ditto) Ditto don't action because of no needs to do something special.

But if you do paste via Quick paste(popup) Ditto will send the saved item to Windows clipboard and doing paste action in tandem. In this case your Windows clipboard is changed already so you can't get last copied clip(exclude using quick paste and find manually)

I think you want to keep the clip ahead of pasted clip after pasted in second situation. If it is, there is no direct option to do it, but i can suggest a bypass way. In Keyboard Shortcuts option tab, uncheck Send Paste, Check Move clips to the top and then make a shortcut at Position 2 (not 1) After, if you pasted something in Ditto and lost ahead clip then press shortcut you assigned to restore. Now the clip restored to OS and top of Ditto's Quick paste list. But it is not fix the clip position but just a repeat of undo to maintain that position, So you need to know what positions 1 and 2 is. While I know it is bothersome to use it, I can not add the feature as fast as you want.

I hope this answer helps you.

PzaThief avatar Jan 05 '24 14:01 PzaThief

Or maybe you can use copy buffer feature to keep something special clip. copy buffer has own space to keep clips so you can fix something special clip in copy buffer and use it when you need.

PzaThief avatar Jan 05 '24 14:01 PzaThief

@PzaThief

Welcome. Can you please tell me more details? What do you want to restore from? ... If it is, there is no direct option to do it, but i can suggest a bypass way. https://github.com/sabrogden/Ditto/issues/592#issuecomment-1878762972

Thanks. The workaround solution almost fit for me. But this changed my habit, where now i must press other than ctrl + v when in need to paste something from "the last clipboard from Windows" (i mean pressing shortcut key to paste a clip in position 1 as this will be "the last clipboard from Windows")

I'm looking a way for Windows clipboard like to be restored to clip position 1 after Ditto paste event (is not simple when in case there is Sticky Clip). This way, i can keep my ~~old habit~~ general Windows user habit, especially when i work on different computer without Clipboard Manager program

cliboard

ariefcfa avatar Jan 06 '24 01:01 ariefcfa

You're right, it will be awesome feature to improve UX. But, there is an invisible obstacle in the way.

When you paste a clip from Ditto, Ditto send it to OS and then make a keyboard event to trigger real paste to your target application. (in screenshot it will be a notepad) The reason for using this approach is to allow the target program to accept the paste without knowing Ditto.

The problem started here. Ditto does not know when the paste operation is complete. (at least in the current version) So, It will be a difficult task, both technically and in terms of the amount of work to adapt this feature.

PzaThief avatar Jan 06 '24 07:01 PzaThief

@PzaThief https://github.com/sabrogden/Ditto/issues/592#issuecomment-1879584763

Thank you! i understand now.

For me alone, maybe i will continue tinkering with Autohotkey for now. Some script like:

^!v::  ; ctrl + alt + v    ; this is my shortcut to show Ditto Quick Paste (popup)
; copy current clipboard to a variable
; send shortcut key to show Ditto Quick Paste (must be changed to ctrl + shift + v  otherwise conflicted with Autohotkey)
; wait until ctr + v detected
; additional wait 1 second maybe
; set clipboard taken from previous variable

ariefcfa avatar Jan 06 '24 08:01 ariefcfa

I will think about it a little more. If you need help with anything, please let me know anytime.

PzaThief avatar Jan 06 '24 11:01 PzaThief