Mac:使用按键移动文件

Mac:使用按键移动文件

是否有任何应用程序可以为 Finder 中的移动操作分配按键。

例如:按 cmd+1,所有选定的文件将移动到名为 songs 的文件夹。

您能想到什么吗?

答案1

您可以在 Automator 中创建如下服务:

然后在键盘偏好设置窗格中为其提供快捷方式。

另一个选择是为脚本指定快捷方式像这样:

activate application "SystemUIServer"
tell application "Finder"
    activate
    move (get selection) to POSIX file ((system attribute "HOME") & "/Documents")
end tell

10.7 和 10.8 中有一个错误,Finder 在获取选择属性时会忽略新窗口。如果您打开一个新的 Finder 窗口,选择其中的一些项目,然后tell app "Finder" to selection在 AppleScript 编辑器中运行,结果就是在最前面的窗口后面的某个窗口中选择了项目,或者是一个空列表。一种解决方法是将焦点移到另一个应用程序然后再移回,但这会导致视觉故障。

或者如果您有 Alfred 2 的 Powerpack,您可以添加一个热键触发器,其中参数设置为 OS X 中的 Selection,并将其连接到运行脚本操作,如下所示:

set input to "{query}"
set text item delimiters to tab
set l to {}
repeat with f in text items of input
    set end of l to (POSIX file f)
end repeat
POSIX file ((system attribute "HOME") & "/Documents")
tell application "Finder" to move l to result

将语言设置为 /usr/bin/osascript 并启用转义双引号和反斜杠。我使用了 AppleScript 而不是 shell 脚本,这样移动操作就会在 Finder 中显示为撤消步骤。如果存在同名路径,脚本会静默退出。

答案2

看一眼键盘大师,它应该就是你要找的东西。

相关内容