wizard=app['7-Zip 19.00 (x64) Setup']
wizard.Install.Click()
time.sleep(5)
wizard.CloseButton.Click()
time.sleep(2)
app=pywinauto.Application().start(r'C:\Program Files\7-Zip\7zFM.exe')
main=app['7-Zip']
main.MenuSelect('Сервис->Настройки...')
settings=app['Настройки']
settings.Button.Click()
settings.ОКButton.Click()
main.Close()
import pywinauto, datetime, threading, time
pid_list=[]; log_list=[]
with open("kill-notepad.log", "a") as log:
log.write(f"{datetime.datetime.now()} | service started, I'am kill all notepad appliction\n")
def logger():
global log_list
if len(log_list)>0:
log_copy=log_list.copy(); log_list=[]
with open("kill-notepad.log", "a") as log:
for i in range(len(log_copy)):
log.write(log_copy.pop(0))
def disabler(main,count):
for i in range(count-count//255):
main.set_transparency(alpha=255-i//(count//255))
def alarm(main):
for i in range(10):
main.Edit.send_keystrokes("НЕЛЬЗЯ ЗАПУСКАТЬ ЭТУ ПРОГРАММУ\n")
def killer():
global pid_list
try:
app=pywinauto.Application().connect(path=r"c:\windows\system32\notepad.exe")
main=app.top_window(); count=10000
if main.process_id() not in pid_list:
pid_list.append(main.process_id())
else:
return
main.set_transparency(alpha=255)
threading.Thread(target=alarm(main)).start()
threading.Thread(target=disabler(main,count)).start()
log_list.append(f'{datetime.datetime.now()} | destroy {main.element_info}\n')
app.kill()
except:
pass
count=0
while True:
if count==10:count=0
time.sleep(1); count+=1
shout=threading.Thread(target=killer)
shout.start()
if count==10:
report=threading.Thread(target=logger)
report.start()
from cx_Freeze import setup, Executable
packages = ['win32serviceutil','win32service','win32event','servicemanager','socket','win32timezone','pywinauto', 'sys', 'datetime', 'not-notepad-service']
build_exe_options = {"packages": packages}
executable = [Executable("not-notepad-service.py")]
setup(name = "StopNotepadService",
version = "1.0",
description = "Stop NotepadApp and Log",
options = {"build_exe": build_exe_options},
executables = executable)
tw = app.window_(title_re="Выбор подразделения")
while not tw.Exists():
sleep(.1)
tw = app.window_(title_re="Выбор подразделения")
#окно появилось - выполняем следующие действия
chrm = Application().connect(title='Chrome browser')
Мой уровень технический знаний - написание простых тестов на C++.
{
"cmd": "c:/Python34/python.exe -u \"$file\"",
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.python",
"env": {"PYTHONIOENCODING": "UTF-8"}
}