function ff { osascript -e 'tell application "Finder"'\
-e 'if (0 < (count Finder windows)) then'\
-e 'set finderpath to get target of the front window as alias'\
-e 'else'\
-e 'set finderpath to get desktop as alias'\
-e 'end if'\
-e 'get POSIX path of finderpath'\
-e 'end tell';};\
function cdff { cd "`ff $@`"; };
Sadly with Total Finder visor it doesn't work.