[granted]Custom Copy collition - scripting access.

Features wanted...
Post Reply
eil
Posts: 1864
Joined: 13 Jan 2011 19:44

[granted]Custom Copy collition - scripting access.

Post 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".
Last edited by eil on 01 Mar 2024 21:38, edited 1 time in total.
Win 7 SP1 x64 100% 1366x768|1900x1080

admin
Site Admin
Posts: 66091
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Custom Copy collition - scripting access.

Post by admin »

Too idiosyncratic.

eil
Posts: 1864
Joined: 13 Jan 2011 19:44

Re: Custom Copy collition - scripting access.

Post by eil »

How about at least variables for collision items?
Win 7 SP1 x64 100% 1366x768|1900x1080

admin
Site Admin
Posts: 66091
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Custom Copy collition - scripting access.

Post by admin »

No way. Remember that this can happen in a background process.

eil
Posts: 1864
Joined: 13 Jan 2011 19:44

Re: Custom Copy collition - scripting access.

Post by eil »

Shame. I really got tired each time to manually go track 2 items, just to send them to comparison.
Win 7 SP1 x64 100% 1366x768|1900x1080

eil
Posts: 1864
Joined: 13 Jan 2011 19:44

Re: Custom Copy collition - scripting access.

Post by eil »

How about at least a way to copy pathes from collision window, by double-click on those bold lines?
Win 7 SP1 x64 100% 1366x768|1900x1080

admin
Site Admin
Posts: 66091
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Custom Copy collition - scripting access.

Post 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):
You do not have the required permissions to view the files attached to this post.

eil
Posts: 1864
Joined: 13 Jan 2011 19:44

Re: Custom Copy collition - scripting access.

Post 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.
Win 7 SP1 x64 100% 1366x768|1900x1080

Norn
Posts: 504
Joined: 24 Oct 2021 16:10

Re: Custom Copy collition - scripting access.

Post 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.
You do not have the required permissions to view the files attached to this post.
Windows 11 24H2 @100% 2560x1440

Norn
Posts: 504
Joined: 24 Oct 2021 16:10

Re: Custom Copy collition - scripting access.

Post 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.
Last edited by Norn on 13 Aug 2023 21:48, edited 1 time in total.
Windows 11 24H2 @100% 2560x1440

admin
Site Admin
Posts: 66091
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Custom Copy collition - scripting access.

Post by admin »

It's not yet implemented for background operations. Next beta.

eil
Posts: 1864
Joined: 13 Jan 2011 19:44

Re: Custom Copy collition - scripting access.

Post 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)
Win 7 SP1 x64 100% 1366x768|1900x1080

Post Reply