cliclick icon indicating copy to clipboard operation
cliclick copied to clipboard

Unexpected behavior with dm command in drag sequence

Open AnjanaPrishor opened this issue 4 months ago • 2 comments

Description: I'm using cliclick 5.0 to automate interactions with ChemDraw, a chemical structure drawing tool. Click and drag operations are common in this application. According to the documentation, the expected pattern for a drag operation is: dd:startX,startY dm:endX,endY du:endX,endY

However, this sequence does not perform the drag action as expected. Instead, the following sequence does work: dd:startX,startY dm:startX,startY du:endX,endY

It seems that the dm command only works correctly when the coordinates match the starting point of the drag (dd). This behaviour appears to contradict the documentation, which suggests that dm should move the mouse to the endpoint of the drag. Could this be a bug in the implementation of the dm command? Or is there a nuance in the expected behaviour that we might be missing?

Any insights or clarification would be appreciated!

Please find attached video recording and a standalone AppleScript (attached as text file as .scpt is not supported)

https://github.com/user-attachments/assets/da45492b-7e83-469a-91ba-eda296a4bd42

clickAndDrag_cliclick.txt

AnjanaPrishor avatar Aug 22 '25 12:08 AnjanaPrishor

Strictly speaking, the built-in help does not suggest using dm for a “simple” drag. For instance, for selecting text in a Mail in Mail.app, executing cliclick dd:657,535 du:844,535 is sufficient (assumed that those coordinates describe the desired selection area) – no dm needed.

I don’t know ChemDraw, but I’d suggest trying without dm first. If that doesn’t work, you could test whether it is a timing issue, using -w. Also, using easing might help. For example, when I try to draw in Pixelmator, with cliclick c:1115,705 dd:. dm:1267,598 du:1383,837, this doesn’t produce the expected result, but with adding -e 200 (cliclick -e 200 c:1115,705 dd:. dm:1267,598 du:1383,837) it does.

BlueM avatar Aug 23 '25 09:08 BlueM

Thank you very much! Using the -e flag resolved the issue perfectly.

AnjanaPrishor avatar Aug 26 '25 04:08 AnjanaPrishor