Mac에서 yyyy-mm-dd hh : mm : ss 타임 스탬프 단축키를 얻는 가장 쉬운 방법은 무엇입니까? 들어 외부에서 작업 할 때 Google

윈도우 내가 사용 PSPad의 당신의 형식, 예를 들어, 편집 할 수있는 좋은 ALT-D 타임 스탬프가 편집기 : MM : SS YYYY-MM-DD HH를 .

편집기, 예를 들어 외부에서 작업 할 때 Google 문서 도구 , 나는이 AutoHotkey를 mm : SS 타임 스탬프 나는 YYYY-MM-DD HH를 삽입 CTRL-D를 프로그램했다.

현재 TextWrangler 를 주로 편집자로 사용 하는 Mac 에서 작업하고 있지만 기능에서 타임 스탬프 핫키를 찾을 수 없습니다.

Mac에서 (무료) 텍스트 편집기 또는 (자동) 자동 단축키와 같은 yyyy-mm-dd hh : mm : ss 단축키를 얻는 가장 쉬운 방법은 무엇입니까?



답변

하나의 옵션은 쉘 스크립트 또는 Python / Perl / Ruby 스크립트를 사용하는 것입니다.

파이썬을 사용하는 하나의 옵션 :

#!/usr/bin/env python
import time
t = time.localtime()
# yyyy-mm-dd hh:mm:ss
print '%d-%02d-%02d %02d:%02d:%02d' % (t.tm_year, t.tm_mon, t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec)

또, 짧은에 의해 @NReilingh 사용 date(쉘 스크립트) :

date "+%Y-%m-%d %T"

이 스크립트를 실행 /Applications/Automator.app하는 서비스 를 작성하는 데 사용하십시오 . Run Shell Script Automator 조치를 추가하고 위 코드를 삽입하십시오. 선택하십시오 아무런 입력 에서 모든 응용 프로그램대체합니다 선택한 텍스트를 . 그런 다음 저장하십시오.

응용 프로그램 이름이있는 메뉴를 선택하면 응용 프로그램의 메뉴 표시 줄에서 액세스 할 수 있는 서비스 메뉴에 배치됩니다 . 사용할 때 다음과 같이 보일 수 있습니다.

시스템 환경 설정 의 키보드 환경 설정 패널에서 키보드 단축키를 지정하십시오 .


더 이상 무료가 아닌 TextExpander 에는 원하는 기능과 유사한 기능이 있습니다. 부분 이메일 템플릿과 같은 스 니펫 삽입을 위해 설계된 애플리케이션입니다.


TextMate 는 확장 가능한 상용 편집기로 셸 또는 스크립팅 언어로 사용자 지정 명령을 쉽게 정의하고 키보드 단축키를 지정할 수 있습니다.


답변

메뉴 막대에서 서비스 메뉴가 표시 될 때까지 Automator 서비스의 바로 가기가 항상 작동하지 않는 10.7 및 10.8의 버그가 있습니다. 서비스가 실행되기 전에 눈에 띄게 지연됩니다. 또 다른 옵션은 다음 과 같이 스크립트에 단축키를 지정하는 것입니다 .

set old to the clipboard as record
set the clipboard to (do shell script "date '+%Y-%m-%d %H:%M:%S'")
tell application "System Events" to keystroke "v" using command down
delay 0.05
set the clipboard to old

keystroke보류 된 수정 자 키를 무시하지 않으므로 명령 이외의 수정 자 키가있는 바로 가기를 사용하여 스크립트를 실행하는 경우 시작에 약간의 지연을 추가하십시오. FastScript 는 키 입력 또는 키 코드 명령이 포함 된 스크립트를 실행하기 전에 수정 자 키가 해제 될 때까지 기다립니다.


답변

이 기능을 서비스로 추가하는 WordService라는 프리웨어 추가 기능을 설치하여 시스템 환경 설정-> 키보드-> 바로 가기에서 키보드 바로 가기를 지정할 수 있습니다.

Mac OSX 팁-http://www.macosxtips.co.uk/index_files/automatically-insert-date-and-time.php의 기사입니다 .

http://www.devontechnologies.com/download/products.html 또는 App Store http://appstore.com/mac/wordservice 에서 다운로드 하십시오.


답변

Lauri의 솔루션은 나보다 훨씬 우아하지만 AppleScript 전용 솔루션입니다. 클립 보드를 통해 실행하고 셸 스크립트를 사용하는 것보다 빠릅니까? 아마도.

어쨌든 : 키에 할당 할 수있는 많은 솔루션이 있지만 가장 쉬운 방법은 Quicksilver Spark FastScripts 입니다. Spark는 scpt를 직접 사용할 수 있으므로 AppleScript 솔루션이 저장합니다.

OSX의 날짜 및 타임 스탬프 트리거

-- yar2050 (Dan Rosenstark)'s favorite date format
-- 2017-08-03 update
on fillInZero(int)
    if (int < 10) then set int to "0" & int
    return int as string
end fillInZero

set theDate to (current date)
set theHour to fillInZero(hours of (theDate) as integer)
set theMinutes to fillInZero(minutes of (theDate) as integer)
tell theDate to get (its month as integer)
set theMonth to fillInZero(result)
set theDay to fillInZero(day of theDate)
tell (theDate) to get (its year as integer) & "-" & (theMonth) & "-" & theDay & " " & (theHour) & ":" & theMinutes
set date_ to (result as string)
tell application "System Events"
    set frontmostApplication to name of the first process whose frontmost is true
end tell


tell application frontmostApplication
    delay 0.2 -- I have no idea why this is necessary
    activate
    tell application "System Events"
        if (frontmostApplication = "Evernote") then
            keystroke "h" using {command down, shift down}
            keystroke "b" using {command down}
            keystroke date_
            keystroke "b" using {command down}
        else
            keystroke date_
        end if
    end tell
end tell

답변

이 질문에 대한 업데이트로 OS X El Capitan 사용자는 다음 AppleScript가 유용 할 수 있습니다.

set the clipboard to (do shell script "date +%Y-%m-%d\" \"%H:%M:%S")
tell application "System Events"
    keystroke "v" using command down
end tell

사용자는 @ daniel-beck의 위 답변에 설명 된대로 AppleScript 실행 워크 플로우를 생성 할 수 있습니다 . 내가 만든 예는 다음과 같습니다.