An AutoHotkey script that uses the ChatGPT API to process selected text.
- Install AutoHotkey v2. Note that this script will not work on earlier versions of AutoHotkey.
- Copy your OpenAI API key here (you may need to create a new secret key)
- Open
ChatGPT AutoHotkey Utility.ahk
using your favorite text editor - Paste your OpenAI API key on the
API_Key
variable
- Launch
ChatGPT AutoHotkey Utility.ahk
- Highlight a text that you want to process using ChatGPT API and press the
back quote
key to bring up the menu
(Image from emacs.stackexchange.com)
You can customize prompts and the menu order by doing the following:
Under Menus and ChatGPT prompts
, add a menu by adding this code:
MenuPopup.Add("&8 - Text_To_Appear", Function_To_Execute_When_Selected)
The character next to the "and" sign (&) is the hotkey for that particular menu that, when pressed, activates it.
You can also add a line separator using this code:
MenuPopup.Add()
You can add a prompt using this code:
Function_To_Execute_When_Selected(*) {
ChatGPT_Prompt := "Your prompt here:"
Status_Message := "Status message that will show while processing the request"
API_Model := "gpt-4" ; or API_Model := "gpt-3.5-turbo"
ProcessRequest(ChatGPT_Prompt, Status_Message, API_Model, Retry_Status)
}
You can edit the API used for each prompt by changing the API_Model
under each prompt. Visit this page to explore a selection of available API models.
You can change the hotkeys under Hotkeys. See here for the list of possible hotkeys.
To suspend the script, press Capslock
& the backtick key
(`)
To close the GUI, press Esc
- AutoHotkey-JSON library
- ai-tools-ahk for the inspiration
- Icons8 for the icon
- WebView2 to convert ChatGPT's Markdown replies into HTML