forked from HungHT1890/CreateChromeProfile
-
Notifications
You must be signed in to change notification settings - Fork 0
/
module_tool.py
41 lines (32 loc) · 983 Bytes
/
module_tool.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
from os import makedirs , path , listdir , system
from shutil import rmtree
from pathlib import Path
def create_profiles_folder(name_folder="Profiles"):
if not path.exists(name_folder):
makedirs(name_folder)
def delete_profile(name_folder):
profile_path = f'Profiles\\{name_folder}'
try:
rmtree(profile_path)
return True
except:
return False
def get_folder_profile_path():
return str(Path.cwd())
def get_profiles():
profiles = []
profiles = [profile_name for profile_name in listdir("Profiles") if not profile_name.endswith('.txt')]
profile_count = len(profiles)
print(f"Profiles: {profile_count}")
for x in profiles:
profile_index = profiles.index(x)
print(f"{profile_index + 1}: {x}")
return profiles
def clear_chrome_process():
try:
system('taskkill /im chrome.exe')
except:
pass
system('cls')
if __name__ == "__main__":
get_profiles()