Created
January 2, 2015 19:28
-
-
Save TatsuyaOGth/d7855651a0f2ed458a50 to your computer and use it in GitHub Desktop.
Automatic Screen Logger Python code for Mac OSX
This file contains hidden or 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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import sys | |
import time | |
import subprocess | |
from datetime import datetime | |
argv = sys.argv | |
if len(argv) > 1: | |
interval_sec = int(argv[1]) | |
else: | |
interval_sec = 60*5 | |
img_format = 'png' | |
savepath = '~/Pictures/Screenshot/' | |
prepend_filename = 'log' | |
print '[[[ START AUTO SCREEN LOGGER ]]]' | |
print '- INTERVAL : ' + str(interval_sec) + 'sec' | |
print '- SAVE PATH : ' + savepath | |
print '- FORMAT : ' + img_format | |
print '- FILENAME : ' + prepend_filename + '_[TIMESTAMP].[FORMAT]' | |
print 'kill command : \'[cmd]+c\'' | |
while True: | |
ts = datetime.now().strftime("%Y-%m-%d_%H-%M-%S") | |
cmd = 'screencapture -x -t '+img_format+' '+savepath+prepend_filename+'_'+ts+'.'+img_format | |
print cmd | |
subprocess.call(cmd, shell=True) | |
time.sleep(interval_sec) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment