If you simply want to install the plugin to get up and running quickly, i suggest downloading the precompiled binaries from the Release section and installing the Tampermonkey user script The installation process is as follows:
- Locate your PowerToys installation (eg.
C:\Program Files\PowerToys
) - Navigate to
\modules\launcher\Plugins
- Unpack the downloaded binaries
- Clone the PowerToys repository to your local disk using the command
git clone https://github.com/microsoft/PowerToys.git
- Navigate to the PowerToys directory using
cd PowerToys
- Initialize and update submodules with the command
git submodule update --init --recursive
- Fork the ChatGPTPowerToys repository on GitHub
- Clone the fork of ChatGPTPowerToys into the local PowerToys repository by running
git clone https://github.com/ferraridavide/ChatGPTPowerToys.git
in thePowerToys\src\modules\launcher\Plugins
directory - In Visual Studio, add the local clone of ChatGPTPowerToys as an existing project to the PowerToys's Plugins folder (
modules\launcher\Plugins
) - Compile
Unfortunately, ChatGPT does not provide a query string parameter for passing prompts. Therefore, we must utilize a browser extension to inject the prompt.
Tampermonkey is a popular browser extension that allows to inject custom user scripts in webpages, visit tampermonkey.net to install it.
Install this script
// ==UserScript==
// @name PowerToys Run ChatGPT Helper
// @version 0.1
// @description https://github.com/ferraridavide/ChatGPTPowerToys
// @author Davide Ferrari
// @match https://chat.openai.com/chat?PTquery=*
// @icon https://raw.githubusercontent.com/ferraridavide/ChatGPTPowerToys/master/src/PowerToys.ChatGPT.BrowserExtension/icons/icon128.png
// @grant none
// ==/UserScript==
(function() {
'use strict';
console.log("PowerToys Run ChatGPT Helper script loaded");
const searchParams = new URLSearchParams(window.location.search);
const prompt = searchParams.get("PTquery");
if (prompt) {
const textArea = document.querySelector("form textarea");
const submitButton = document.querySelector("form button");
if (!textArea || !submitButton) {
console.error("Cannot find required elements");
}
textArea.value = prompt;
setTimeout(() => {
textArea.value = prompt;
submitButton.click();
}, 0);
}
})();
AIPRM extension compatible version of script
// ==UserScript==
// @name PowerToys Run ChatGPT Helper
// @version 0.1
// @description https://github.com/ferraridavide/ChatGPTPowerToys
// @author Davide Ferrari
// @match https://chat.openai.com/chat?PTquery=*
// @icon https://raw.githubusercontent.com/ferraridavide/ChatGPTPowerToys/master/src/PowerToys.ChatGPT.BrowserExtension/icons/icon128.png
// @grant none
// ==/UserScript==
(function() {
'use strict';
console.log("PowerToys Run ChatGPT Helper script loaded");
const searchParams = new URLSearchParams(window.location.search);
const prompt = searchParams.get("PTquery");
if (prompt) {
setTimeout(() => {
const textArea = document.querySelector("form textarea");
const submitButton = document.querySelectorAll("form button")[1]; // AIPRM add another button so change with the second button
if (!textArea || !submitButton) {
console.error("Cannot find required elements");
}
textArea.value = prompt;
submitButton.disabled = false // I don't know why this happen but changing value not updating so change manually
submitButton.click();
}, 2000);
}
})();
- Open your preferred browser and navigate to the settings or preferences menu.
- Locate the option for "extensions" or "add-ons" and select it.
- Enable developer mode in the extensions settings page.
- In the extensions menu, look for a button or option labeled "Load Unpacked" or "Add Unpacked Extension."
- Select the folder containing the extension and click "Open."