-
Notifications
You must be signed in to change notification settings - Fork 59
/
Copy pathcreateMacro.py
34 lines (24 loc) · 1.06 KB
/
createMacro.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
import os
from macro.mainmacro import CreateMacro
import sys
class Macro(object):
def __init__(self,saveas,url,text,textloc,buttontex,buttonloc,imgpath,imgloc,fname):
try:
mfile = saveas+"\\"+fname+'.xlsm'
macro = '%s'% os.getcwd()+"\\"+"macro"+"\\"+"createfile"+"\\"+'DownloadMacro.txt'
asfile = saveas+"\\"+fname+'.xlsm'
savemacroformatfile = 52
filecontrol = os.listdir(saveas)
for _ in filecontrol:
file,extension = os.path.splitext(_)
if ".bin" or ".xlsm" in _:
if ".bin" in extension:
os.remove(saveas+"\\"+file+extension)
elif ".xlsm" in extension:
pass
else:
pass
CreateMacro(macro,savemacroformatfile,mfile,saveas,url,text,textloc,buttontex,buttonloc,imgpath,imgloc,asfile)
except Exception as f:
t, o, tb = sys.exc_info()
print(f, tb.tb_lineno)