Hello,
I would like to integrate natural language AI like GPT-3 into my macros, for example send a command and some text to GPT-3 and then plug the result into a macroscheduler variable (similar to the way regex may be used). I would like to do this using their API and not their website form interface. I am not a programmer but can follow basic MS tutorials. Any ideas for starting points?
For those not familiar with GPT-3
https://beta.openai.com/examples/
How to integrate GPT-3 into my macro
Moderators: JRL, Dorian (MJT support)
Re: How to integrate GPT-3 into my macro
Have you guys seen ChatGPT yet? It can generate autohotkey scripts from natural language descriptions. It is familiar with MS but does not know enough about it to generate scripts. What are MS's plans to integrate this type of technology?
Re: How to integrate GPT-3 into my macro
for example I just did this:
QUERY
write an autohotkey script that opens notepad, sends text hello world, sends the file to a printer then closes notepad
RESULT
Here is an AutoHotkey script that will open Notepad, send the text "hello world" to it, send the file to a printer, and then close Notepad:
Copy code
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
; Open Notepad
Run Notepad
; Send the text "hello world" to Notepad
SendInput hello world
; Save the file and send it to the printer
FileSave
FilePrint
; Close Notepad
FileClose
To use this script, you will need to have AutoHotkey installed on your computer. To run the script, you can simply double-click on the file. You may need to adjust the printer settings to specify which printer you want to use.
QUERY
write an autohotkey script that opens notepad, sends text hello world, sends the file to a printer then closes notepad
RESULT
Here is an AutoHotkey script that will open Notepad, send the text "hello world" to it, send the file to a printer, and then close Notepad:
Copy code
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
; Open Notepad
Run Notepad
; Send the text "hello world" to Notepad
SendInput hello world
; Save the file and send it to the printer
FileSave
FilePrint
; Close Notepad
FileClose
To use this script, you will need to have AutoHotkey installed on your computer. To run the script, you can simply double-click on the file. You may need to adjust the printer settings to specify which printer you want to use.
-
- Newbie
- Posts: 1
- Joined: Sat Apr 12, 2025 2:07 pm
Re: How to integrate GPT-3 into my macro
Hi! I'm not a programmer either, but I can help you out a bit.ari wrote: ↑Tue Apr 12, 2022 4:46 pmHello,
I would like to integrate natural language AI like GPT-3 into my macros, for example send a command and some text to GPT-3 and then plug the result into a macroscheduler variable (similar to the way regex may be used). I would like to do this using their API and not their website form interface. I am not a programmer but can follow basic MS tutorials. Any ideas for starting points?
For those not familiar with GPT-3
https://beta.openai.com/examples/
Get an OpenAI API Key
First, you'll need to sign up for an OpenAI API key. This is a prerequisite for working with GPT-3 via the API.
Sending Requests via PowerShell or Python
Since you're not a programmer, it's easiest to start with PowerShell or Python, as they don't require any complex setup. If you're using PowerShell, your API request will look something like this:
Code: Select all
powershell
$url = "https://api.openai.com/v1/completions"
$headers = @{
"Content-Type" = "application/json"
"Authorization" = "Bearer YOUR_API_KEY"
}
$body = @{
"model" = "text-davinci-003"
"prompt" = "Your Request or Text"
"max_tokens" = 100
} | ConvertTo-Json
$response = Invoke-RestMethod -Uri $url -Method Post -Headers $headers -Body $body
$response.choices[0].text
Using the result in macros
Once you get the result from GPT-3, you'll need to write it into a variable in your macro. This depends on which macro manager you're using. For example, in PowerShell you can just parse the response and put it into the desired variable, which you can then use in your macro.
Just start with simple queries
Start with simple queries like "Write a short text about..." and work your way up. The key is to not try to get everything perfect right away. Once you get the hang of the basics, it'll be easier to move on.
I hope this helps!
I use Overchat AI in my work. Namely, I generate texts for my website.