-
Notifications
You must be signed in to change notification settings - Fork 3
/
PYMR1.py
83 lines (53 loc) · 2.2 KB
/
PYMR1.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 16 23:20:46 2019
@author: *****
"""
from win32 import win32gui
import os
import time
import smtplib
import sendAndrecv
import pyautoguii
while True :
try :
hwnd = win32gui.FindWindow(None,'Spyder (Python 3.6)')
win32gui.SetForegroundWindow(hwnd)
try:
sendAndrecv.cmdreceiver('(FROM "*****")','(SUBJECT "****")') #Try using subject name for each communication channel / task cmd
except Exception:
pass
#time.sleep(1)
pyautoguii.saveipcnsl()
#pyautoguii.sceenshot()
execpath="C:/****/******/Desktop/Rfile/pyremote***/ExchangeFolder/ToReceive/"
pyautoguii.sceenshot()
fllpth=[]
for root, dirs, files in os.walk(os.path.abspath(execpath)):
for file in files:
fullpathz =os.path.join(root, file)
fllpth.append(fullpathz)
#print(fullpathz)
#print(fllpth)
for file in fllpth :
if file.find('.py') != -1 :
print('py found')
print(file)
try :
exec(open(file).read()) #execute what ever .py you want. This my need some setting of the environnement.
except Exception :
print(' ERROR DETECTED while exec ')
#print(Exception)
else:
print(file)
f = open(file , 'r')
notpy = f.read()
f.close()
print(notpy)
time.sleep(1)
sendAndrecv.sendfct()
except smtplib.SMTPServerDisconnected :
print('lost wirelss')
except Exception:
pass
time.sleep(600)