Skip to content

Instantly share code, notes, and snippets.

@lmm214
Last active August 29, 2015 14:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lmm214/f3533cb091e43af83957 to your computer and use it in GitHub Desktop.
Save lmm214/f3533cb091e43af83957 to your computer and use it in GitHub Desktop.
Hexo 新建日志 AppleScript 脚本,原作者是 Octopress 版本的,捣鼓了一个下午终于成功转到 Hexo ,并去除了不影响功能的代码.
(*
* Hexo 新建日志 AppleScript 脚本(hexo_new_post.applescript)
* 原作者:https://gist.github.com/roshanca/4118971
* 修改者:林木木 http://immmmm.com/
* 版本:2014.7.10
* 说明:原作者是 Octopress 版本的,捣鼓了一个下午终于成功转到 Hexo ,并去除了不影响功能的代码.
*)
tell application "Finder"
activate
display dialog "填入文章标题" default answer "title"
set postTitle to text returned of result as text
end tell
tell application "Terminal"
activate
if (count of windows) is 0 then
tell application "System Events"
keystroke "n" using {command down}
end tell
else
activate
end if
repeat with win in windows
try
if get frontmost of win is true then
set currentTab to selected tab of win
if currentTab is not busy then
do script "cd ~/Dropbox/hexo" in currentTab
-- 需修改到自己的 Hexo 所在路径
do script "hexo new " & postTitle in currentTab
delay 1
do script "open -a Mou source/_posts/" & postTitle & ".md" in currentTab
-- 已设置用 Mou 编辑
end if
end if
end try
end repeat
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment