I use the program VisiPics to delete dupicate pictures. The processing time for deletion varies dependent on the number of pictures and duplicates. I created an Xdotool command to carry out certain operations on Visipics:

xdotool mousemove 239 85 click 1 mousemove 316 68 click 1 mousemove 413 71 click 1 mousemove 605 243 click 1 click 1 click 1 click 1 click 1 mousemove 468 301 click 1 sleep 30 mousemove 817 170 click 1 mousemove 769 483 click 1 mousemove 809 249 sleep 1 click 1 mousemove 757 484 click 1 mousemove 800 487 click 1 mousemove 839 11 click 1 mousemove 760 485 click 1

Here's a visual of the actions:

enter image description here

The part of the command that is posing problems is step 3 in the picture above. I've found that sleep works sometimes:

mousemove 468 301 click 1 sleep 30 mousemove 817 170 click 1

Since the wait time for processing pictures varies, the sleep command doesn't work well all the time. I've also tried using the --delay command but I get the error xdotool: Unknown command: --delay.

Incidentally I asked a similar question relating to Visipics a couple years ago, but it doesn't help me with this particular issue, though the actions I want Xdotool to perform with Visipics are the same.

Is there a way for Xdotool to determine that the program has finished processing the pictures before performing the rest of the actions?

  • 2
    Have you considered using a different tool which may not need this automation? – l0b0 Oct 25 '18 at 3:43
  • Visipics is the best image dupe finder I've ever used, and I've used lots of them, for both Windows and Linux. Visipics also works perfectly with Wine. The developer has said that he plans on creating a cli version, but since it's a hobby he's in no rush. However I haven't tried a few of the dupe programs listed at your link, so I'll check them out. – whitewings Oct 25 '18 at 4:35
  • Waiting for a process to end can easily be done in a shell script. But reading the rest of the question sounds like that isn't what you are trying to do. Please update your question such that title and question are asking the same thing. – kasperd Oct 25 '18 at 12:44
  • How would you suggest I word it? "XDoTool Command to Wait For Step in Process to End"? – whitewings Oct 25 '18 at 17:23

The answer is that currently this cannot be done. The sleep/--delay commands are your only possible workarounds if you keep doing it this way.

The only way you can fully, reliably automate the process is

  • A: If the utility in question can be operated from the command-line instead of GUI, find out what commandline arguments are needed, in what order, then set up an alias in bashrc so you can run it at any time.
  • B: Finding an alternative program that can do the same thing via the command line instead of relying on a GUI.

A quick google search will tell you that for visipics 2 is supposed to support this in a pro version according to it's concept, however since it has not yet been developed, and it's been like 8 years since plans were made for it, it's unlikely we'll see that anytime soon.

Which leaves you only with the option to either settle with what you have right now and keep using sleep, or switch to a different tool like dupeGuru or fslint.

Your Answer

