WSL + shareX + autohotkeyで、定期的にスクリーンショットを撮影してGoogle driveで同期し、
スマホなどでリモートリーかつコンスタントリーに状況を確認できるシステムを考えてみました。
やってること
autohotkeyで5分毎にsharexでスクリーンショットを撮影
5分+α毎にGoogle driveにスクリーンショットフォルダをコピー
ソースコード
C:\pg\autohotkey\per5_printScreen.ahk
loop{
send, {PrintScreen}
sleep 300000 ;5m
}
C:\pg\autohotkey\per5_ps_run.sh
# cmd.exe /C "C:\Program Files\AutoHotkey\AutoHotkeyU64.exe" C:/pg/autohotkey/per5_printScreen.ahk
. cmd.sh & # ref:https://qiita.com/nyango/items/7b6b719f248b2ee8d379
sleep 5
while [ 1 ] ; do
echo "copy to google_drive"
cp -r "/mnt/c/Users/USER/OneDrive/ドキュメント/ShareX/Screenshots" /mnt/c/google_drive/
sleep 300
done
C:\pg\autohotkey\cmd.sh
cmd.exe /C "C:\Program Files\AutoHotkey\AutoHotkeyU64.exe" C:/pg/autohotkey/per5_printScreen.ahk
変数
- “/mnt/c/Users/USER/OneDrive/ドキュメント/ShareX/Screenshots”:shareXのスクリーンショット保存先
- /mnt/c/google_drive/:同期中のdriveディレクトリ
使用方法
- bash:cd /mnt/c/pg/autohotkey/
- bash:. /mnt/c/pg/autohotkey/per5_ps_run.sh
終了プロセス:
1. bashコマンドを終了
1. ahkスクリプトを終了