Page 1 of 1

[granted]Custom Copy collition - scripting access.

Posted: 07 Aug 2023 21:12
by eil
Often when collision happens during copy/move operations, the list of options CC provides is not enough(especially for "power-users").
What if:
- user wants to open one of items to check if maybe some remarks left, why item is in place, or...
- user decides to copy both items to separate place while skipping this one collision, or...
- user prefers to open 2 collision items in Beyond Compare for deciding collision after that.

All this variety of tasks can be done manually, though it's kinda bothersome. Yet this could be solved with scripting, by simply 2 things added(which this Wish is about):
1. Add variables corresponding to 2 items currently in collision. Smth lime <colitem1> <colitem2>.
2. Scripting button in CC collision window, just like Hamburger Menu button, that allows to incorporate own script.

Me personally especially interested in ability to send 2 items for comparison in some app(like BC), and only after results make a collision decision. Mind that collision while coping quite often is not expected, and user suddenly gets to know item already exists, so definitely more research and checks needed than simple deciding "this item is newer, so do overwrite".

Re: Custom Copy collition - scripting access.

Posted: 08 Aug 2023 10:21
by admin
Too idiosyncratic.

Re: Custom Copy collition - scripting access.

Posted: 08 Aug 2023 20:12
by eil
How about at least variables for collision items?

Re: Custom Copy collition - scripting access.

Posted: 08 Aug 2023 20:14
by admin
No way. Remember that this can happen in a background process.

Re: Custom Copy collition - scripting access.

Posted: 08 Aug 2023 21:37
by eil
Shame. I really got tired each time to manually go track 2 items, just to send them to comparison.

Re: Custom Copy collition - scripting access.

Posted: 09 Aug 2023 09:54
by eil
How about at least a way to copy pathes from collision window, by double-click on those bold lines?

Re: Custom Copy collition - scripting access.

Posted: 09 Aug 2023 10:07
by admin
Right-click the bold lines to get a small Copy Path menu. :)

Actually left-click as well, but that's a bug I'm gonna fix NOW.

The next version will also have a command to copy both paths (one per line):

Re: Custom Copy collition - scripting access.

Posted: 09 Aug 2023 20:48
by eil
admin wrote: 09 Aug 2023 10:07 The next version will also have a command to copy both paths (one per line):
Now that's a thing i can work with! Thanks.

If anybody else reading this topic may know an elegant way to check if <clipboard> has exactly 2 pathes and nothing else, please share a hint.

Re: Custom Copy collition - scripting access.

Posted: 12 Aug 2023 20:47
by Norn
The latest version doesn't have "Copy Both Paths"?
Check this option, you will see the white menu item "Copy Path".
Configuration | File Operations | File Operations | Background Processing | Enable background processing | Apply to... | Copy (can be queued)

If I uncheck it I will get the normal dark menu with two items. Checking Move cross-volume (can be queued) has no effect.

Re: Custom Copy collition - scripting access.

Posted: 12 Aug 2023 23:50
by Norn
AutoHotkey script.

Code: Select all

; For v24.80.0004 - 2023-08-13 19:57
#Requires AutoHotkey v2.0
SetTitleMatchMode 1
CoordMode "Mouse", "Screen"

#HotIf winExist("Custom Copy")
F3::
{
    MouseGetPos &xpos, &ypos
    try
	{
	  controlClick("ThunderRT6PictureBoxDC3", "Custom Copy",, "RIGHT")
	  while !CCid := winExist("ahk_class #32768 ahk_exe XYplorer.exe") {
	    if (CCid := winExist("ahk_class #32768 ahk_exe XYcopy.exe") || A_Index = 500)
		     break
	  }
	  WinGetPos &X, &Y,,, "ahk_id " CCid
	  SystemCursor("Hide")
	  ;ControlSend("{down}{down}{enter}", , "ahk_id " CCid)   ; Click the "Copy Both Paths" button
      click X+5, Y+30                          ; Click the "Copy Both Paths" button
	  click xpos, ypos, 0                      ; Restore mouse position
	  SystemCursor("Show")
	  pathSaved := A_Clipboard
	  A_Clipboard := ""                        ; Empties the clipboard.

	  paths := strSplit(pathSaved, "`r`n")
	  if(paths.length > 3)
	     return

      pathCount := 0
      for path in paths
          if fileExist(path)
             pathCount++
      if(pathCount = 2) {
         msgbox "Path 1:`n" paths[1]
         msgbox "Path 2:`n" paths[2]
      }
	} catch {
	  ToolTip "Try again"
	  SetTimer () => ToolTip(), -2000
	}
}
#HotIf



; Toggle Cursor
SystemCursor(cmd)  ; cmd = "Show|Hide|Toggle|Reload"
{
    static visible := true, c := Map()
    static sys_cursors := [32512, 32513, 32514, 32515, 32516, 32642
                         , 32643, 32644, 32645, 32646, 32648, 32649, 32650]
    if (cmd = "Reload" or !c.Count)  ; Reload when requested or at first call.
    {
        for i, id in sys_cursors
        {
            h_cursor  := DllCall("LoadCursor", "Ptr", 0, "Ptr", id)
            h_default := DllCall("CopyImage", "Ptr", h_cursor, "UInt", 2
                , "Int", 0, "Int", 0, "UInt", 0)
            h_blank   := DllCall("CreateCursor", "Ptr", 0, "Int", 0, "Int", 0
                , "Int", 32, "Int", 32
                , "Ptr", Buffer(32*4, 0xFF)
                , "Ptr", Buffer(32*4, 0))
            c[id] := {default: h_default, blank: h_blank}
        }
    }
    switch cmd
    {
    case "Show": visible := true
    case "Hide": visible := false
    case "Toggle": visible := !visible
    default: return
    }
    for id, handles in c
    {
        h_cursor := DllCall("CopyImage"
            , "Ptr", visible ? handles.default : handles.blank
            , "UInt", 2, "Int", 0, "Int", 0, "UInt", 0)
        DllCall("SetSystemCursor", "Ptr", h_cursor, "UInt", id)
    }
}
I see that the control that displays the text is a picture control, so I can't directly get the text of the control.

Re: Custom Copy collition - scripting access.

Posted: 13 Aug 2023 09:11
by admin
It's not yet implemented for background operations. Next beta.

Re: Custom Copy collition - scripting access.

Posted: 23 Aug 2023 10:26
by eil
Wanna thank Norn for an AHK script, and share my simplistic XY script that i use for Beyond Compare.(with paths in clipboard check-use included)