目前我正在使用这个 AppleScript 来获取 Finder 的当前目录:
tell application "Finder"
return POSIX path of ((folder of the front window) as text)
end tell
当您经常运行它时,例如将它放入一个文件并运行while true; do sleep 1; osascript -ss myscript; done
,您会看到每次 Finder 都会挂起一点。
如何避免挂起?有没有其他方法可以获取这些信息?