Fork me on GitHub

MAC用automator创建小应用解决一些简单需求

本来是要解决mac一个很蠢的问题的:无法新建文件。

之前的策略有两种:一是复制粘贴其他的文件过来。另一个是cd到当前目录下然后touch一个文件。这个有点麻烦,首先cd还得拖到终端一个文件才能找对位置。

这次用了Mac自带的automator自己做一个简单的生成新文件的应用,非常简单。

显然既然automator还可以用shell脚本,能低成本实现的东西还是很多的。

STEPS

open automator

select application

Markdown

select AppleScript on left bar

WRITE

1
2
3
4
5
6
7
8
on run {input, parameters}

tell application "Finder"
set selection to make new file at (get insertion location)
end tell

return input
end run

save as file.app in somewhere

YOU can use your own icon, just change the picture to icns and drag it to apps/contents/resources to replace the original one. And also copy your picture to the Get Info Menu

customize toolbar

drug your new application to toolbar

Markdown

DONE

Markdown

NEXT TIME click the button above to enjoy your design

As you can see, I design another one to sync my scripts, contents:

1
2
3
4
5
6
7
8
9
10
rsync -avzh /Users/james/Desktop/website/jamesblog /Volumes/New\ Drive/
rsync -avzh /Users/james/Desktop/bear /Volumes/New\ Drive/
rsync -avzh /Users/james/Desktop/爷爷回忆录gitbook /Volumes/New\ Drive/
rsync -avzh /Users/james/Desktop/三春 /Volumes/New\ Drive/
rsync -avzh --max-size='5M' --exclude-from='exclude_me.txt' hpc1:~/projects/ /Volumes/New\ Drive/hpc1backup
rsync -avzh --max-size='5M' --exclude-from='exclude_me.txt' ibme:~/projects/ /Volumes/New\ Drive/ibmebackup
cp /Users/james/snippets.json /Users/james/Library/Jupyter/nbextensions/snippets/snippets.json
rsync -avzh /Users/james/snippets.json ibme:/Share/home/chenxupeng/.local/share/jupyter/nbextensions/snippets/
rsync -avzh /Users/james/snippets.json cnode:/home/chenxupeng/.local/share/jupyter/nbextensions/snippets/snippets.json
rsync -avzh /Users/james/snippets.json hpc1:/home/chenxupeng/.local/share/jupyter/nbextensions/snippets/

Markdown

-----The ---- end ------- Thanks --- for --- Reading----