from win32gui import GetWindowText, GetForegroundWindow import random def repeat_function(n): minewindow = GetWindowText(GetForegroundWindow()) if n > 0: v = random.choice(['a', ':', 'c', 'r', 'g']) with open('file.txt', 'a') as f: f.write(f'{minewindow}: {v}\n') repeat_function(n-1) repeat_function(7)
Configuration: 1 Configuration: s Configuration: 2 Configuration: : Configuration: 3 Configuration: y Configuration: q
Configuration: 1s2:3yq