일반용과 논문용의 구두점 입력 스타일을 한번에 전환
13084 단어 AppleScriptYosemiteMacOSXTeXLaTeX
머리
、。
와 ,.
를 한 번에 전환할 수 있는 AppleScript입니다. 전국의 이계 대학생 Macer에 수요가 있지 않을까? 라고 생각해 써 보았습니다. 단지 AppleScript는 지금까지 전혀 쓴 적이 없는 사람이므로, 개량점등 있으면 꼭 보고해 주세요.
본편
Yosemite 표준 JapaneseIM 용입니다.
소스 코드
tell application "System Preferences"
set current pane to pane "com.apple.preference.keyboard"
reveal anchor "InputSources" of pane "com.apple.preference.keyboard"
end tell
tell application "System Events"
if not UI elements enabled then
set UI element enableld to true
end if
tell tab group 1 of window 1 of application process "System Preferences"
tell table 1 of scroll area 1
select item 1 of (every row whose (name of UI element 1 is "日本語"))
end tell
tell pop up button 4 of scroll area 2
click
tell menu 1
if selected of menu item 1 then
click menu item 4
else
click menu item 1
end if
end tell
end tell
end tell
end tell
-- 1回ごとにシステム環境設定を終了したい場合はコメントアウトを解除
-- (但し次回の実行に時間がかかる)
-- if application "System Preferences" is running then
-- tell application "System Preferences" to quit
-- end if
사용법
위를 확장자.applescript
로 임의의 디렉토리에 저장해, 쇼트 컷 키등을 이용해 호출할 수 있도록 해 둡니다. 여기에서는 ~/.switch_punct_style.applescript
로 저장했다고 가정합니다.
BetterTouchTool을 사용하는 예
Global에 중복되지 않는 바로 가기 키를 할당하고 동작으로 Execute Terminal Command
를 선택합니다.
그런 다음 나타나는 텍스트 상자에 다음 명령을 입력합니다.
osascript ~/.switch_punct_style.applescript
그리고는 설정한 단축키를 누르면…
추가
Yosemite 표준 JapaneseIM 용입니다.
소스 코드
tell application "System Preferences"
set current pane to pane "com.apple.preference.keyboard"
reveal anchor "InputSources" of pane "com.apple.preference.keyboard"
end tell
tell application "System Events"
if not UI elements enabled then
set UI element enableld to true
end if
tell tab group 1 of window 1 of application process "System Preferences"
tell table 1 of scroll area 1
select item 1 of (every row whose (name of UI element 1 is "日本語"))
end tell
tell pop up button 4 of scroll area 2
click
tell menu 1
if selected of menu item 1 then
click menu item 4
else
click menu item 1
end if
end tell
end tell
end tell
end tell
-- 1回ごとにシステム環境設定を終了したい場合はコメントアウトを解除
-- (但し次回の実行に時間がかかる)
-- if application "System Preferences" is running then
-- tell application "System Preferences" to quit
-- end if
사용법
위를 확장자
.applescript
로 임의의 디렉토리에 저장해, 쇼트 컷 키등을 이용해 호출할 수 있도록 해 둡니다. 여기에서는 ~/.switch_punct_style.applescript
로 저장했다고 가정합니다.BetterTouchTool을 사용하는 예
Global에 중복되지 않는 바로 가기 키를 할당하고 동작으로
Execute Terminal Command
를 선택합니다.그런 다음 나타나는 텍스트 상자에 다음 명령을 입력합니다.
osascript ~/.switch_punct_style.applescript
그리고는 설정한 단축키를 누르면…
추가
이런 사정에서 GoogleIME과 JapaneseIM을 모두 사용해 가기로 했으므로, 양자를 좋은 느낌으로 전환해 주는 스크립트를 자신용으로 메모해 둡니다. 주로 US 키보드로 「전의 입력 소스를 선택」을 이용하고 있는 사람용입니다.
tell application "System Events"
if not UI elements enabled then
set UI element enableld to true
end if
tell menu bar 1 of application process "SystemUIServer"
tell item 1 of (every menu bar item whose description is "text input")
if value is "英数 (Google)" or value is "ひらがな (Google)" then
set modes to {"ひらがな", "英字"}
else
set modes to {"ひらがな (Google)", "英数 (Google)"}
end if
repeat with mode in modes
click
tell menu 1
click item 1 of (every menu item whose name is contents of mode)
end tell
end repeat
end tell
end tell
end tell
개인적으로 침착할 것 같은 사용법
、。
로 한다. ,.
로 한다. Reference
이 문제에 관하여(일반용과 논문용의 구두점 입력 스타일을 한번에 전환), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/mpyw/items/e2749ba8d68310d983a1텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)