def METHOD_NAME(
    caption_text,
    images_dir,
    overwrite,
    caption_ext,
    prefix,
    postfix,
    find_text,
    replace_text,
):
    # Check if images_dir is provided
    if not images_dir:
        msgbox(
            'Image folder is missing. Please provide the directory containing the images to caption.'
        )
        return
    # Check if caption_ext is provided
    if not caption_ext:
        msgbox('Please provide an extension for the caption files.')
        return
    if caption_text:
        log.info(f'Captioning files in {images_dir} with {caption_text}...')
        # Build the command to run caption.py
        run_cmd = f'python "tools/caption.py"'
        run_cmd += f' --caption_text="{caption_text}"'
        # Add optional flags to the command
        if overwrite:
            run_cmd += f' --overwrite'
        if caption_ext:
            run_cmd += f' --caption_file_ext="{caption_ext}"'
        run_cmd += f' "{images_dir}"'
        log.info(run_cmd)
        # Run the command based on the operating system
        if os.name == 'posix':
            os.system(run_cmd)
        else:
            subprocess.run(run_cmd)
    # Check if overwrite option is enabled
    if overwrite:
        if prefix or postfix:
            # Add prefix and postfix to caption files
            add_pre_postfix(
                folder=images_dir,
                caption_file_ext=caption_ext,
                prefix=prefix,
                postfix=postfix,
            )
        if find_text:
            # Find and replace text in caption files
            find_replace(
                folder_path=images_dir,
                caption_file_ext=caption_ext,
                search_text=find_text,
                replace_text=replace_text,
            )
    else:
        if prefix or postfix:
            # Show a message if modification is not possible without overwrite option enabled
            msgbox(
                'Could not modify caption files with requested change because the "Overwrite existing captions in folder" option is not selected.'
            )
    log.info('Captioning done.')