;CompareWithNextScore
(let ((first (d-SelectTab))(second #f) (message #f))
	(define (SetSecondPosition)
		(define position (GetPosition))
		(d-SelectTab second)
		(apply d-GoToPosition position)
		(d-SelectTab first))
    (set! second (d-SelectTab (1+ first)))
    (if (= first second)
        (set! first (d-SelectTab (1- first))))
    (d-SelectTab first)
    (if (= first second)
       (d-WarningDialog (_ "Only one score is open"))
	(begin
		(d-NextObject)    
		(let loop ()
			(SetSecondPosition)
			(d-InfoDialog (string-append (_ "Working at bar ") (number->string (d-GetMeasure))))
			(d-KeepAlive)
			(set! message (d-CompareObjectsAtCursor first second))
			(if message
				(d-InfoDialog message)
				(if (d-NextObject)  
					(loop)
					(d-WarningDialog (_ "No more differences in this staff"))))))))