#!/usr/bin/python # -*- coding: utf-8 -*- import re import os import sys # sec="1250005988" # dir='.' # if len(sys.argv) > 1: wdir = sys.argv[1] sec = sys.argv[2] base_filename = sec + '.s' reGetNumber = re.compile(base_filename + '(\d*).png') largest_screenshot_number = -1 for f in os.listdir(wdir): # print f m = reGetNumber.match(f) if m: # print f # print m.groups(1)[0] n = int(m.groups(1)[0]) largest_screenshot_number = max(largest_screenshot_number, n) # print largest_screenshot_number keycodes = ['', 'KK: \Afn'] keycodes.extend(open(wdir + '/' + sec + '.KEYCODEpure')) keycodes.extend(open(wdir + '/' + sec + '.KEYCODEpure+')) def Highlight_Keycode_i(keycodes, i): s = '' for (j, k) in enumerate(keycodes): # print k if k[0:4] == 'KK: ': k = k[4:] if j == i: s = s + '' + k + '' else: s = s + k return s print '' print '