tell application "Finder"if(count of windows) is not 0 then
set thePath to POSIX path of (target of front window as text)elseset thePath to POSIX path of (desktop as text)endifend tell
tell application "Terminal"do script "cd " & quoted form of thePath
activate
end tell