Some Applescripts that meet Lamberhand's needs.
- Script: Open Terminal then Change Directory
- Script: Print to PDF with Safari
- Script: Play Album with NeteaseMusic
- Script: Play Song with NeteaseMusic
- Configuration Guide
Git operation on Mac relies on command line tool. It frustates me when manually typing in $ cd /.../.../...
after opening Terminal.
This scripts opens Terminal and automatically change directory to current folder and execute $ ls
for you to check items in current folder. Now you are free to operate with Git or whatever you want in this directory.
If current application is other than Finder, this script will only open Terminal for you.
When I search for research papers, it is very possible that direct PDF download link is not provided by databases (eg. SpringerLink, ScienceDirect, etc.). Clicking "Download PDF" buttons will lead you to a webpage showing this PDF. To save it requires more additional steps:
Press ⌘+P to open print settingsChange button "PDF" to "Save as PDF"Go back and copy the title of articlePaste to the nameClick save
This script will help you tremendously shorten this procedure by nearly 5 seconds when you find yourself trapped in this situation. It does all the job for you, including reading your clipboard and paste to text field when saving. Here is what you need to do now:
- Copy the title of article
- Run this script
- Confirm and save
I listen to music with NeteaseMusic in most cases. When I listen to music, I listen by album in most cases. I have The Dark Side of the Moon, Slowdive, Treasure, Unknown Pleasures, etc. in my Favorites of albums in NeteaseMusic. Opening application and click and wait multiple times costs time, energy and mood. All I want is typing in souvl and Souvlaki is played subsequently.
This script opens NeteaseMusic and prompt dialog for input. Keyword accepted will be used to search in 我的收藏 page. If item exists, soon it will be played from the beginning.
So make sure you have albums you want in your 我的收藏 folder. If not, this scripts will let you know. If there are multiple search results, this scripts will let you decide. If you don't type anything in, this scripts will open your 我的收藏 page and let you browse.
It generally takes approx. 5 to 20 seconds to start playing depending on network responsiveness. Since NeteaseMusic doesn't expose interfaces to AppleScript, it is potential that this script fails to bring you to your music. Just run it again if this is the case.
As stated in previous section, this script, similarly, serves the purpose of searching a song, not album, in Favorites.
Still in construction
-
Clone this repository or download .zip containing srcipts.
-
⌘+Space to open Spotlight search. Input Automator to open Automator. Choose Quick Action/服务, creating new document.
-
Search AppleScript in search bar on the top left. Drag and drop Run AppleScript/运行AppleScript into workflow column on the right side.
-
Copy script and paste into window Run AppleScript/运行AppleScript. , overriding all the internal codes. After pasting the whole script should be like this:
on run ...(Thingy copied) ...(Thingy copied) ...(Thingy copied) end run
-
⌘+S to save this quick action/服务. Specify a proper name.
-
Click on the top left corner to open System Preferences.../系统偏好设置 . Choose Keyboard/键盘 ⇒ Shortcuts/快捷键设置⇒ Services/服务. Scroll to bottom and find your entitled service. Set a proper shotcuts as you like.
-
Good to go. Press the keyboard shotcut which you chose and enjoy. Initial launch in any new app will cause a window asking for access. Choose OK freely.
My personal shotcut assigning share:
Script Shotcut Open Terminal then Change Directory ⌥⌘+` Play Album with NeteaseMusic ⌃⌥⌘+M Print to PDF with Safari ⌃⌥⌘+P ⌃ - control ⌥ - option / alt ⌘ - command ⇧ - shift
- Clone this repository or download .zip containing srcipts.
- Click and open the script you want by Script Editor/脚本编辑器 (by default).
- Click File/文件 ⇒ Export/导出 on the menu bar. Choose File Format to Application. Specify a name and folder to export.
- Good to go. ⌘+Space to open Spotlight search and search the application which you entitled. Initial launch in any new app will cause a window asking for access. Choose OK freely.
Keyboard Maestro provides more convienent approach to binding keyboard chortcuts to script than automator does. Since it is a paid application and its configuration is similar to that of A, we don't dive into Keyboard Maestro any longer for now.
Developed by Lamberhand@SJTU