     (if (= (process-exit-status process) 0)
         (progn
           (with-current-buffer (dired-script--exec-calling-buffer exec)
-            (when revert-buffer-function)
-            (funcall revert-buffer-function))
+            (when revert-buffer-function
+              (funcall revert-buffer-function))
+            (when-let* ((before (dired-script--exec-files-before exec))
+                        (after (dired-script--dired-files))
+                        (oldest-new-file (car (last (seq-sort #'file-newer-than-file-p
+                                                              (seq-difference after before))))))
+              (dired-goto-file oldest-new-file)))
+          (when (dired-script--exec-on-completion exec)
+            (funcall (dired-script--exec-on-completion exec)))
           (unless (equal (process-buffer process)
                          (window-buffer (selected-window)))
             (kill-buffer (process-buffer process))))

   "ffmpeg -loglevel quiet -stats -y -i <<f>> -pix_fmt rgb24 -r 15 <<fne>>.gif
    gifsicle -O3 <<fne>>.gif --lossy=80 -o <<fne>>.gif"
   "Convert to optimized gif" '("ffmpeg" "gifsicle")))

(defun dired-script-speed-up-gif ()
  "Speeds up gif(s)."

              (unless (equal (process-buffer proc)
                             (window-buffer (selected-window)))
                (kill-buffer (process-buffer proc))))))
      (with-current-buffer proc-buffer
        (require 'shell)
        (shell-mode))
      (setq dired-script--execs
            (push (cons (process-name proc)
                        (make-dired-script--exec :script script
                                                 :process proc
                                                 :name (process-name proc)
                                                 :calling-buffer (current-buffer)
                                                 :files-before (dired-script--dired-files)
                                                 :reporter (make-progress-reporter (process-name proc))))
                  dired-script--execs))
      (set-process-sentinel proc #'dired-script--sentinel)
