自從使用了macbook之后,我便在網(wǎng)絡(luò)上大量搜索能夠有效提高效率的軟件,大部分人的推薦都會(huì)有一個(gè)叫做Alfred的應(yīng)用,這篇文章講解了一個(gè)簡單的alfredworkflow是如何寫出來的。
什么是Alfred?
Alfred is an award-winning app for Mac OS X which boosts your efficiency with hotkeys, keywords, text expansion and more. Search your Mac and the web, and be more productive with custom actions to control your Mac.
點(diǎn)擊進(jìn)入Alfred官網(wǎng)
Workflow匯總
直切主題,有自己寫workflow想法的你肯定已經(jīng)知道什么是Alfred、怎么使用Alfred,但實(shí)際上自己寫一個(gè)workflow真的很簡單。
下面我會(huì)一步一步的整理出我是如何寫出這一簡單的功能的。
1.設(shè)置Workflow Defaults
1.1打開Alfred#####
打開Alfred的Workflow,點(diǎn)擊左下角的加號(hào)。
1.2填寫基本信息
2.創(chuàng)建Blank Workflow
2.1新建Blank Workflow
2.2填寫信息
分別為workflow名稱、功能描述、功能分類,圖中右上角的方框是workflow的Icon,支持拖拽找到圖片直接拖進(jìn)去即可。
2.3得到workflow界面
3.制作Workflow
3.1 新建Inputs#####
在界面上右鍵得到如下圖結(jié)果,選擇Inputs中的Keyword
3.1.1 填寫自定義信息#####
得到如下圖結(jié)果,填寫你想要設(shè)置的 激活詞組 、標(biāo)題以及簡介,我這里定義成new。
3.1.2實(shí)際使用演示
3.2 新建Actions#####
在界面上右鍵得到如下圖結(jié)果,選擇Actions中的Run NSAppleScript
3.2.1 編輯代碼#####
雙擊得到如下圖結(jié)果,接著雙擊轉(zhuǎn)到代碼編輯頁面
將your script here更換成你想要實(shí)現(xiàn)的功能的代碼即可,當(dāng)然此處只能用Apple的script來寫。
此處我的代碼是
on alfred_script(q)
tell application "Finder"
set selection to make new file at (get insertion location)
end tell
end alfred_script
如果想用其他語言在請(qǐng)選擇在3.2時(shí)選擇Run Script即可,可以自己選擇所用語言,如下圖