xyzzyで
- スクリーンショットを撮ってあらかじめ指定したディレクトリに保存
- 保存したファイルのパスを貼り付け
という処理ができるようにする。winshotを利用。
準備
以下をsite-lispフォルダに保存。winshotのパスや保存フォルダは各自読み替えてください。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; -*- Mode: Lisp -*- | |
;; | |
;; winshotで矩形スクリーンショットを撮って保存。そのパスを貼り付ける | |
;; | |
;; Installation: | |
;; | |
;; ~/.xyzzy または $XYZZY/site-lisp/siteinit.l に以下のコードを追加 | |
;; | |
;; (require "screenshot") | |
;winshotの実行ファイルパス | |
(defvar *winshot-exe* "D:\\bin\\winshot\\winshot.exe") | |
;スクリーンショット保存フォルダ | |
(defvar *screenshot-dir* "D:\\work\\SS") | |
;保存ファイルの書式 | |
(defvar *screenshot-filename* "%Y-%m-%d-%H%M%S.jpg") | |
;winshotのオプション | |
(defvar *winshot-option* "-Jpeg -Rectangle -Close -File") | |
(defun screenshot () | |
(interactive) | |
(let* ((filename (format-date-string *screenshot-filename*)) | |
(dirname *screenshot-dir*) | |
(filepath (merge-pathnames filename dirname)) | |
(winshotpath *winshot-exe*) | |
(option *winshot-option*)) | |
(progn (call-process (concat winshotpath " " option " " filepath)) | |
(insert (map-slash-to-backslash filepath))))) |
.xyzzyに以下を追記
(load-library "screenshot")
やり方
M-x screenshot
スクリーンショットしたい箇所を矩形選択
スクリーンショットが保存され、かつそのパスが貼り付けられる