- Create new:
Services
- Services receives no input in any application
- Use the search to find and add action:
Run Applescript
- Copy and paste the following to the field on the right:
tell application "System Events"
set _Date to (current date)
keystroke ¬
(year of _Date as text) & "_" & ¬
text -2 thru -1 of ("00" & ((month of _Date) as integer)) & "_" & ¬
(day of _Date as text) & " " & ¬
text -2 thru -1 of ("00" & ((hours of _Date) as integer)) & ":" & ¬
text -2 thru -1 of ("00" & ((minutes of _Date) as integer)) & ":" & ¬
text -2 thru -1 of ("00" & ((seconds of _Date) as integer))
end tell
Note that the day
will not have a leading zero like the month
does. If you want that, you could replace the line with: (day of _Date as text)
with: text -2 thru -1 of ("00" & ((day of _Date) as integer))
- Save with: Cmd + S. Give it a name you can remember in the next step.
- If you simply use the
Save
command ( Cmd + S ) instead ofSave as...
the Service file is automatically put in the right place.
- If you simply use the
The next step would be to define a shortcut for the service you just made.
Use either one of these methods:
My first recommendation would beServices Manager.- If you install and open it, all you need to do is search for the service you just saved before and double click the
key
area (This I have to admit isn't super obvious, because the area isn't well defined. You can probably see other shortcuts for other services, which kinda indicates that this is where you can change the shortcut.) - Its default path is
/Applications/Utilities/Services Manager.app
- This app is incredibly useful for managing
Service
shortcuts, but if this is just a one time thing, you can just use the method described below, which doesn't require extra applications to be installed.
- If you install and open it, all you need to do is search for the service you just saved before and double click the
Another way would be to go to mac
System preferences > Keyboard > Shortcuts > Services
and then find the service you saved before. You should find it at the bottom area of the list. Then you just double click thenone
text on the right side of the service name and give it a shortcut.
'소프트웨어 개발 > macOS' 카테고리의 다른 글
Softwares on my macOS v0.2 (0) | 2018.05.22 |
---|