100% found this document useful (1 vote)
2K views3 pages

Guide To Autostart Aihawk

Guide to start AI HAWK

Uploaded by

harisshaikh92
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
2K views3 pages

Guide To Autostart Aihawk

Guide to start AI HAWK

Uploaded by

harisshaikh92
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Guide to Auto start AiHawk

Step 1- Open the below file in visual studio code and make the default resume format
“myenv\Lib\site-packages\lib_resume_builder_AIHawk\manager_facade.py”
Step 2 – modify the prompt_user function as shown in the below image:

If you need any other format other than first one change the number with the respective digit starting
with 0
Step 3 – Copy the below code in a new text document and place it anywhere you like and save it with
an extension (.bat)

@echo off

:: Paths file to store the virtual environment and main.py paths


set paths_file=%~dp0saved_paths.txt

:: Check if paths are already saved in the file


if exist "%paths_file%" (
echo Loading saved paths...
for /f "tokens=1* delims=:" %%A in ('type "%paths_file%"') do (
if "%%A"=="venv_path" set venv_path=%%B
if "%%A"=="main_py_dir" set main_py_dir=%%B
)
) else (
echo First time setup: You will need to provide the paths.

:: Step 1 - Prompt the user for the path to the Python virtual environment
set /p venv_path="Enter the path to your Python virtual environment: "

:: Step 2 - Ask for the path of the main.py file


set /p main_py_dir="Enter the path to the directory containing main.py: "

:: Save the paths for future use


echo venv_path:%venv_path% > "%paths_file%"
echo main_py_dir:%main_py_dir% >> "%paths_file%"
echo Paths saved for future use.
)

:: Activate the virtual environment


call "%venv_path%\Scripts\activate.bat"
if %errorlevel% neq 0 (
echo Failed to activate virtual environment.
pause
exit /b 1
)

:: Navigate to the directory containing main.py


cd /d "%main_py_dir%"
if %errorlevel% neq 0 (
echo Failed to change directory to %main_py_dir%.
pause
exit /b 1
)

:: Run the main.py file


start "" /wait python main.py
if %errorlevel% neq 0 (
echo Failed to run main.py.
pause
exit /b 1
)

:: Step 4 - Set this script to run at Windows startup


echo Adding script to Windows startup...
set startup_folder="%appdata%\Microsoft\Windows\Start Menu\Programs\Startup"
if not exist %startup_folder% (
echo Startup folder does not exist, creating it...
mkdir %startup_folder%
)

copy "%~f0" %startup_folder%


if %errorlevel% neq 0 (
echo Failed to copy the script to the startup folder.
pause
exit /b 1
)

:: Prompt the user to ensure they run the script once


echo Please make sure you run this script once to ensure it is saved in the
startup folder.
echo It will now run automatically when Windows starts.
pause

:: End
echo Script setup complete.
pause

Step 4 – Run the script once it will prompt for the virtual environment path and your main.py file
provide the follow the image below :
Step 5 – It will open the bot if you need run it else close it, It will save a file named as saved_paths.txt
where the paths of the virtual environment and directory of main.py will be saved
Step 6 – The bot will be added to the start up folder once you run this
That’s it enjoy running the script and AiHawk

You might also like