tell application "BBEdit"
if class of front window = differences window then
set vFileA to POSIX path of ((file of first document of front window) as string)
set vFileB to POSIX path of ((file of second document of front window) as string)
set vCommand to "/opt/homebrew/bin/diff -y --color=always" & space & the quoted form of vFileA & space & the quoted form of vFileB & space & "| /opt/homebrew/bin/aha --stylesheet > ~/Desktop/output.html"
do shell script (vCommand)
do shell script "open ~/Desktop/output.html"
end if
end tell
HTH
Jean Jourdain