|
1 | 1 | import time |
2 | 2 | import pyautogui |
3 | 3 |
|
4 | | -print("Welcome to the PYI installer", "\u00A9", " 2024 26gbush") |
5 | | -print("") |
6 | | -print("The PYI installer uses 'pip' to install apps, and therefore is an EXTENSION of pip") |
7 | | -print("pyautogui is needed to install apps") |
8 | | -print("") |
9 | | -pyautoinstalled = input("do you have pyautogui installed Y/N") |
10 | | -if pyautoinstalled = Y |
| 4 | +def install_package(): |
| 5 | + """Function to handle package installation via pyautogui.""" |
11 | 6 | while True: |
12 | 7 | print("") |
13 | | - ml = input("PYI INSTALLER: ") |
14 | | - pyautogui.hotkey('win' , 'r') |
| 8 | + ml = input("PYI INSTALLER: ").strip() |
| 9 | + pyautogui.hotkey('win', 'r') |
15 | 10 | pyautogui.typewrite('powershell') |
16 | 11 | pyautogui.press('enter') |
17 | 12 | time.sleep(2) |
18 | | - pyautogui.press('enter') |
19 | | - pyautogui.typewrite('pip install ' +ml) |
20 | | - |
| 13 | + pyautogui.typewrite('pip install ' + ml) |
21 | 14 | pyautogui.press('enter') |
22 | 15 | time.sleep(2) |
23 | | - pyautogui.typewrite('press enter to exit powershell') |
| 16 | + pyautogui.typewrite('echo Press enter to exit PowerShell') |
24 | 17 | pyautogui.press('enter') |
25 | 18 | pyautogui.typewrite('exit') |
26 | | - print("") |
27 | | - print("If the installation did not work, check if you misspelled it.") |
28 | | -else |
29 | | - print("to install pyautogui press the Windows Key and r to open run (apart of Windows that will run what you type in)") |
30 | | - print("then type in powershell: pip install pyatuogui") |
31 | | - doneinstall = input("type Y to run the PYI installer") |
32 | | - if doneinstall = Y |
33 | | - while True: |
34 | | - print("") |
35 | | - ml = input("PYI INSTALLER: ") |
36 | | - pyautogui.hotkey('win' , 'r') |
37 | | - pyautogui.typewrite('powershell') |
38 | | - pyautogui.press('enter') |
39 | | - time.sleep(2) |
40 | | - pyautogui.press('enter') |
41 | | - pyautogui.typewrite('pip install ' +ml) |
42 | | - |
43 | | - pyautogui.press('enter') |
44 | | - time.sleep(2) |
45 | | - pyautogui.typewrite('press enter to exit powershell') |
46 | 19 | pyautogui.press('enter') |
47 | | - pyautogui.typewrite('exit') |
48 | 20 | print("") |
49 | 21 | print("If the installation did not work, check if you misspelled it.") |
| 22 | + |
| 23 | +def install_pyautogui_instructions(): |
| 24 | + """Guide user to install pyautogui if not installed.""" |
| 25 | + print("To install pyautogui:") |
| 26 | + print("1. Press the Windows Key + R to open Run.") |
| 27 | + print("2. Type 'powershell' and press Enter.") |
| 28 | + print("3. In PowerShell, run: pip install pyautogui") |
| 29 | + done_install = input("Once installed, type Y to run the PYI installer: ").strip().upper() |
| 30 | + if done_install == "Y": |
| 31 | + install_package() |
| 32 | + |
| 33 | +def main(): |
| 34 | + """Main function for the PYI installer.""" |
| 35 | + print("Welcome to the PYI Installer", "\u00A9", "2024 26gbush") |
| 36 | + print("") |
| 37 | + print("The PYI installer uses 'pip' to install apps and is an EXTENSION of pip.") |
| 38 | + print("pyautogui is needed to install apps.") |
| 39 | + print("") |
| 40 | + |
| 41 | + pyautoinstalled = input("Do you have pyautogui installed (Y/N)? ").strip().upper() |
50 | 42 |
|
| 43 | + if pyautoinstalled == "Y": |
| 44 | + install_package() |
| 45 | + elif pyautoinstalled == "N": |
| 46 | + install_pyautogui_instructions() |
| 47 | + else: |
| 48 | + print("Invalid input. Please restart the installer and type 'Y' or 'N'.") |
| 49 | + |
| 50 | +if __name__ == "__main__": |
| 51 | + main() |
| 52 | + |
0 commit comments