sabrogden / Ditto

Ditto is an extension to the Windows Clipboard. You copy something to the Clipboard and Ditto takes what you copied and stores it in a database to retrieve at a later time.
https://ditto-cp.sourceforge.io/
3.94k stars 208 forks source link

In script : clip.SetParentId(<insert group id>); does not work #672

Open vict75 opened 6 months ago

vict75 commented 6 months ago

Carefully tried many variations on this example:

if(clip.AsciiTextMatchesRegex(".*.+\\@.+\\.(com|net|edu|gov).*") == 1)
{
    clip.SetParentId(<insert group id>);
}

return false;

With and without the if statement, make sure the regexp always matches with ".*" looked up 2 different group id via property Window Title. No luck. Replaced SetParentId with clip.SetAsciiString(newString), that works for the paste but new string is not saved in the buffer.

[2024/5/14 19:10:35.486 - ExternalWindowTracker.cpp 25] Not Idle for long enough, IdleTime: 0.000000, MinIdle 0.100000 [2024/5/14 19:10:36.820 - QPasteWnd.cpp 1028] Start Open Selection [2024/5/14 19:10:36.821 - QPasteWnd.cpp 979] Start OpenId, Id: 3116, Only CF_TEXT: Plain Text: 0 [2024/5/14 19:10:36.822 - OleClipSource.cpp 229] Start of paste script name: Paste and move to Done, script: clip.SetParentId(3089);

return false; [2024/5/14 19:10:36.830 - OleClipSource.cpp 240] End of paste script name: Paste and move to Done, returned true, last Error: [2024/5/14 19:10:36.831 - OleClipSource.cpp 1067] Start of put format on clipboard [2024/5/14 19:10:36.832 - OleClipSource.cpp 1110] Setting clipboard type: CF_TEXT to the clipboard [2024/5/14 19:10:36.833 - OleClipSource.cpp 1110] Setting clipboard type: CF_UNICODETEXT to the clipboard [2024/5/14 19:10:36.833 - OleClipSource.cpp 1120] End of put format on clipboard [2024/5/14 19:10:36.834 - ProcessPaste.cpp 153] start of MarkAsPasted [2024/5/14 19:10:36.848 - ProcessPaste.cpp 171] End of MarkAsPasted [2024/5/14 19:10:36.849 - ProcessPaste.cpp 63] Sending Paste to active window [2024/5/14 19:10:36.848 - ProcessPaste.cpp 181] Start of MarkAsPastedThread [2024/5/14 19:10:36.849 - ClipboardViewer.cpp 242] OnClipboardChange - Start [2024/5/14 19:10:36.850 - ClipboardViewer.cpp 244] OnClipboardChange - End [2024/5/14 19:10:36.850 - ProcessPaste.cpp 232] Setting clipId: 3116, order: 4478.000000 [2024/5/14 19:10:36.866 - ExternalWindowTracker.cpp 175] Activate Target - Active: 985996, Focus: 461962 [2024/5/14 19:10:36.871 - QPasteWnd.cpp 746] CQPasteWnd::OnActivate, nState: 0, Other: 0, Minimized: 0 [2024/5/14 19:10:36.873 - ProcessPaste.cpp 266] End of MarkAsPastedThread [2024/5/14 19:10:36.878 - QPasteWnd.cpp 817] Start of HideQPasteWindow [2024/5/14 19:10:36.889 - QPasteWnd.cpp 901] End of HideQPasteWindow, ItemCount: 10 [2024/5/14 19:10:36.899 - ExternalWindowTracker.cpp 112] found focus wait 0 [2024/5/14 19:10:36.900 - ExternalWindowTracker.cpp 254] Sending paste to app Notepad.exe key stroke: ^{VKEY86}, SeDelay: 100 [2024/5/14 19:10:36.900 - UAC_Helper.cpp 28] I'm running elevated: 0, They are running elevated: 0, PASTE AS ADMIN: 0 [2024/5/14 19:10:37.040 - ExternalWindowTracker.cpp 285] Post sending paste [2024/5/14 19:10:37.042 - QPasteWnd.cpp 1021] End OpenId, Id: 3116, Only CF_TEXT: Plain Text: 0 [2024/5/14 19:10:39.027 - MainFrm.cpp 303] On Show Ditto HotKey, showing window [2024/5/14 19:10:39.028 - ExternalWindowTracker.cpp 100] TargetActiveWindow Active: s36-Test1-Dtd1-7 - Notepad (985996), Focus: s36-Test1-Dtd1-7 - Notepad (461962), FromHook 1, IdleTime: 0.000000 [2024/5/14 19:10:39.030 - QuickPaste.cpp 80] Start of ShowQPasteWnd, AtPrevPos: 0, FromKeyboard: 1, RefillList: 0 [2024/5/14 19:10:39.048 - QPasteWnd.cpp 746] CQPasteWnd::OnActivate, nState: 1, Other: 0, Minimized: 0 [2024/5/14 19:10:39.049 - QPasteWnd.cpp 922] Start - ShowQPasteWindow - Fill List: 0, array count: 10 [2024/5/14 19:10:39.050 - Theme.cpp 79] Loading theme based on windows setting of dark mode for apps [2024/5/14 19:10:39.063 - QPasteWnd.cpp 958] END - ShowQPasteWindow - Fill List: 0, array count: 10 [2024/5/14 19:10:39.065 - QPasteWnd.cpp 2882] SetKeyModiferState 1

manually moved a clip to group 3089, works fine:

[2024/5/14 19:13:28.987 - QPasteWnd.cpp 4035] Move to Group, GroupId: 3089 [2024/5/14 19:13:28.987 - ClipIds.cpp 200] MoveTo, Start, Size: 1, ParentId: 3089 [2024/5/14 19:13:28.987 - Clip.cpp 1500] GetNewOrder, Id: 3121, parentId: 3089, CurrentMax: 0.000000, CurrentDesc: , NewMax: 0.000000 [2024/5/14 19:13:29.006 - ClipIds.cpp 224] MoveTo, Sql Ret: 1, SQL: UPDATE Main SET lParentID = 3089, clipGroupOrder = 0.000000 WHERE lID = 3121 AND lID <> 3089; [2024/5/14 19:13:29.006 - QPasteWnd.cpp 1374] Start Fill List - [2024/5/14 19:13:29.009 - EventThread.cpp 210] Start of CEventThread::RunThread() - OnEvent 3 - Name CQPasteWndThread

vict75 commented 6 months ago

I'm running the Store install version, maybe that matters. I also had to look hard for my log file.

LimingZhangBj commented 5 months ago

same here

sabrogden commented 4 months ago

It's working for me. The SetParentId only works on copy scripts, not on paste scripts. So when ingesting the clip the parent will be set. Make sure your script is in the on copy script section.

Also make sure your parent id is set correctly.

  1. open the groups menu
  2. right click on the group and open the properties window
  3. image
  4. in the properties window in the title bar it shows the id, sorry it's not very obvious
  5. image
  6. use that id in your copy script