import subprocess

print("This script is meant to end some tasks that are resource hogging and unnecessary to help PC performance.")
print("Press 'A' to close if you don't want to do anything and 'B' if you want to end the tasks. The following tasks that will be closed are microsoft edge, Copilot, one note, python.exe and pythonw.exe .")

choice = input("Enter 'A' to close the program and not do anything or 'B' to run the script and end Microsoft Edge and Copilot to save PC resources: ")

def kill_process(process_name):
    try:
        # Call the taskkill command
        subprocess.run(['taskkill', '/F', '/IM', process_name], check=True)
        print(f"Terminated process: {process_name}")
    except subprocess.CalledProcessError as e:
        print(f"Error: {e}")

if choice.upper() == 'A':
    print("You chose option 1.")
    process_to_kill = "python.exe"
    kill_process(process_to_kill)
    process_to_kill = "pythonw.exe"
    kill_process(process_to_kill)

elif choice.upper() == 'B':
    print("You chose option 2.")
    # Specify the process name you want to terminate
    process_to_kill = "msedge.exe"  # Adjust the name as necessary
    kill_process(process_to_kill)
    process_to_kill = "onenote.exe"
    kill_process(process_to_kill)
    process_to_kill = "python.exe"
    kill_process(process_to_kill)
    process_to_kill = "pythonw.exe"
    kill_process(process_to_kill)
    process_to_kill = "Bsmain32.exe"
    kill_process(process_to_kill)
    
else:
    print("Invalid choice. Please try again.")

print("thanks for using this script enjoy")
