(Emacs24.3, MacOSX10.8)
リロードさせるやつと、スクロールのやつの続き
- Emacs から Google Chrome を Applescript でリロードするメモ(MacOS only) - 牌語備忘録 - pygo
- Emacs からバックグラウンドの Google Chrome を Applescript でスクロールさせるメモ(MacOS only) - 牌語備忘録 - pygo
Applescript
下記リンクのコードそのまま
next-tab-chrome.scpt
tell application "Google Chrome" set maxIndex to count tabs of (first window) set currentIndex to active tab index of (first window) set proposedIndex to currentIndex + 1 if proposedIndex < 1 then set proposedIndex to maxIndex if proposedIndex > maxIndex then set proposedIndex to 1 set (active tab index of (first window)) to proposedIndex end tell
previous-tab-chrome.scpt
tell application "Google Chrome" set maxIndex to count tabs of (first window) set currentIndex to active tab index of (first window) set proposedIndex to currentIndex - 1 if proposedIndex < 1 then set proposedIndex to maxIndex if proposedIndex > maxIndex then set proposedIndex to 1 set (active tab index of (first window)) to proposedIndex end tell
Emacs lisp
init.el
(defun next-tab-chrome () (interactive) (shell-command "osascript ~/.emacs.d/site-macosx/next-tab-chrome.scpt") (message "next-tab-chrome") ) (global-set-key (kbd "<M-s-right>") 'next-tab-chrome) (defun previous-tab-chrome () (interactive) (shell-command "osascript ~/.emacs.d/site-macosx/previous-tab-chrome.scpt") (message "previous-tab-chrome") ) (global-set-key (kbd "<M-s-left>") 'previous-tab-chrome)
こんな感じ