Some utils for Windows to aid in the workflow when working with AI Prompts.
This repository contains utilities to enhance your workflow when working with AI prompts. The provided PowerShell scripts help in managing and converting documents to Markdown format, combining multiple Markdown files into a single DOCX, archiving files, and setting up the necessary environment.
- setup.ps1: Sets up the environment by creating a symbolic link, adding context menu entries, and creating a SendTo shortcut.
- remove.ps1: Cleans up the environment by removing the symbolic link, context menu entries, and SendTo shortcut created by
setup.ps1
. - create-markdown.ps1: Converts
.docx
and.pdf
files to Markdown format (.md
). - create-docx.ps1: Converts
.md
and.pdf
files to DOCX format (.docx
). - combine-and-convert.ps1: Combines multiple Markdown files and converts the result to a single DOCX file.
- combine-and-convert.bat: A batch file that acts as an intermediary between the Windows SendTo menu and the combine-and-convert.ps1 script.
- archive.ps1: Archives files in a specified directory.
- install-pandoc.ps1: Downloads and installs the latest version of Pandoc, and adds it to the system PATH.
To get started, you need to set up the environment by running the setup.ps1
script. This script will:
- Create a symbolic link in the
Program Files
directory pointing to this repository. - Add context menu entries for
.docx
and.pdf
files to allow easy conversion to Markdown format using thecreate-markdown.ps1
script. - Add context menu entries for
.md
and.pdf
files to allow easy conversion to DOCX format using thecreate-docx.ps1
script. - Create a SendTo shortcut for the combine-and-convert functionality.
-
Open PowerShell as an Administrator.
-
Navigate to the directory where this repository is located.
-
Run the setup script:
.\setup.ps1
This will create a symbolic link in C:\Program Files\AI-Prompt-Workflow-Utilities
, add context menu entries, and create the SendTo shortcut.
If you wish to remove the setup, you can run the remove.ps1
script. This script will:
- Remove the context menu entries created by
setup.ps1
. - Delete the symbolic link created in the
Program Files
directory. - Remove the SendTo shortcut.
-
Open PowerShell as an Administrator.
-
Navigate to the directory where this repository is located.
-
Run the removal script:
.\remove.ps1
This will clean up all changes made by the setup script, restoring your system to its previous state.
This script converts .docx
and .pdf
files to Markdown format (.md
). It performs the following steps:
- Checks if the provided file is a
.docx
or.pdf
file. - If an
archive.ps1
script is found in the same directory, it runs the archive script to back up the current state of files. - Uses Pandoc to convert the file to Markdown format.
- Outputs the result to the same directory with the
.md
extension.
This script converts .md
and .pdf
files to DOCX format (.docx
). It performs the following steps:
- Checks if the provided file is a
.md
or.pdf
file. - If an
archive.ps1
script is found in the same directory, it runs the archive script to back up the current state of files. - Uses Pandoc to convert the file to DOCX format.
- Outputs the result to the same directory with the
.docx
extension.
This script combines multiple Markdown files and converts the result to DOCX format. It performs the following steps:
- Accepts multiple file paths as input.
- Sorts the input files alphabetically.
- Combines the content of all input Markdown files into a single temporary file.
- Uses the
create-docx.ps1
script to convert the combined Markdown to DOCX format. - Cleans up the temporary combined Markdown file.
- Places the resulting DOCX file in the same directory as the first input file.
This batch file serves as an intermediary between the Windows SendTo menu and the combine-and-convert.ps1
script. It:
- Receives file paths from the SendTo menu.
- Properly formats these paths for use with PowerShell.
- Calls the
combine-and-convert.ps1
script with the formatted file paths.
This script archives files in a specified directory. It performs the following steps:
- Checks if an
Archive
sub-directory exists in the current directory; if not, it creates it. - Copies files from the current directory to the
Archive
sub-directory, naming them with a timestamp to avoid overwriting existing files. - Provides feedback on the archiving process.
This script downloads and installs the latest version of Pandoc, a universal document converter. It performs the following steps:
- Queries the GitHub API to get the latest release information for Pandoc.
- Downloads the appropriate installer for the current platform.
- Launches the installer and waits for the installation to complete.
- Verifies that
pandoc.exe
is installed in the expected location. - Adds
pandoc.exe
to the system PATH if it is not already present.
After running the setup script, you can:
- Right-click on a
.docx
or.pdf
file. - Select "Create Markdown (AI Prompt)" from the context menu to convert to Markdown.
Or:
- Right-click on a
.md
or.pdf
file. - Select "Create DOCX (AI Prompt)" from the context menu to convert to DOCX.
To combine multiple Markdown files and convert them to a single DOCX:
- Select multiple Markdown (.md) files in File Explorer.
- Right-click on the selection.
- Choose "Send to" > "Combine and Convert to DOCX" from the context menu.
The selected files will be combined in alphabetical order and converted to a single DOCX file. The resulting DOCX file will be placed in the same directory as the first selected Markdown file, with a filename based on the names of the first and last input files.
To install Pandoc:
-
Open PowerShell as an Administrator.
-
Navigate to the directory where this repository is located.
-
Run the Pandoc installer script:
.\install-pandoc.ps1
This will ensure that the latest version of Pandoc is downloaded, installed, and added to the system PATH.
- Windows operating system
- PowerShell 5.0 or later
- Administrator privileges to run the setup and removal scripts
- Pandoc for document conversion (install using
install-pandoc.ps1
script)
This project is licensed under the MIT License - see the LICENSE file for details.