我的KeyboardMaestro宏

Keyboard Maestro作为Mac下出名的效率软件,有着不菲的名声,是Winner of a Macworld Editors’ Choice Award for 2013.

官网的介绍是:

Whether you are a power user or a grandparent (or both!), your time is precious. So why waste it when Keyboard Maestro can help improve almost every aspect of using your Mac. Even the simplest things, like typing your email address, or going to Gmail or Facebook, launching Pages, or duplicating a line, all take time and add frustration. Let Keyboard Maestro help make your Mac life more pleasant and efficient.

工欲善其事必先利其器,在使用Mac工作学习的过程中发现一些跟之前使用习惯不适应和”稍微反人类的”一些操作,比如在Finder中的*”在当前目录打开终端”*等操作,因此想到了Keyboard Maestro,通过它来简化一些操作将大大提高效率,也更加简便.

然后在这里简单介绍我常用的一些宏(常更新哦)

Finder

Finder作为使用率最高的软件之一,首先介绍Finder相关的宏.由于快捷键太难记忆而决定采用Palette,Finder不会占据太大的空间,因此Palette也不会出现遮挡Finder窗口的问题.

finder palette

显示为

finder palette display

  • 在Finder中显示”在terminal中打开”,很简单如下图实现

finder terminal

  • 新建文件(文件名自行输入)

由于Keyboard Maestro支持Apple Script,因此可以通过如下代码实现:

1
2
3
4
5
6
7
8
tell application "Finder"
set annoying_path to the target of the front window as text
set actual_path to POSIX path of annoying_path
set something to display dialog "File name?" default answer ""
set textReturned to text returned of something
set newFileName to actual_path & textReturned
set accessNum to open for access newFileName with write permission
end tell

点击"新建文件"时,会提示窗口输入文件名

new file

  • 复制文件名

只需如下脚本:

1
2
3
4
5
tell application "Finder"
set theFile to the selection
set fileName to name of item 1 of theFile
set the clipboard to fileName
end tell

另外Mac自带的脚本编辑器,可以编写运行Apple Script,在写脚本时可以用它写完测试ok后再复制到Keyboard Maestro中.

  • 复制文件绝对路径

有时在终端下工作时,或者其他环境中需要某一文件的路径,这时候使用绝对路径会是有效可靠且方便的,同样脚本为:

1
2
3
4
tell application "Finder"
set sel to the selection
set the clipboard to POSIX path of (sel as text)
end tell

结合Apple Script, Keyboard Maestro可以发挥更加强大的功能,慢慢通过不断的需求和学习可以开发出更多新的功能

Launch Apps

对于一些常用的应用程序可以设定某些快捷键,方便快速启动,就像在Linux下面,Alt + control + T 开启终端,win下面, win + D开启文件管理器.

我常用的如:

launch apps

设定自己习惯,容易记忆的快捷键即可.

另外,发现每次截图之后想要寻找截图照片变得繁杂,因此每次截图后主动在Finder下显示截图目录

截图 弹窗

(逐渐更新中….)