Skip to content

Commit

Permalink
Making more error resilient and adding readme info
Browse files Browse the repository at this point in the history
  • Loading branch information
mxro committed Sep 15, 2023
1 parent 3f4531c commit dfa54ef
Showing 4 changed files with 69 additions and 11 deletions.
60 changes: 56 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,66 @@
# Autohotkey ChatGPT

## Build Source Code
Use your voice to control Windows 📢

| You say | Windows does |
| -------------------------- | ------------------------------------------------ |
| Open Firefox | Opens Firefox |
| Search for cupcake recipes | Opens browser and searches for 'Cupcake Recipes' |
| Tell me the first 20 digits of Pi | Shows a window with the 20 first digits of Pi |

⚠ WARNING ⚠ This is an experimental application. ChatGPT can end up doing random stuff. So please use with caution!

## Install

- Download and install AutoHotKey V1 from [autohotkey.com](https://www.autohotkey.com/)
- Download `AutoHotKey-ChatGPT.zip` from the [Releases](https://github.com/mxro/autohotkey-chatgpt-voice/releases) for the latest release.
- Extract `AutoHotKey-ChatGPT.zip`
- Edit `config.json` from the extracted files. Provide your [Open API Key](https://www.howtogeek.com/885918/how-to-get-an-openai-api-key/) for the property `OpenapiKey`.

```json
{
"OpenapiKey": "",
"AutoHotKeyExec": ".\\bin\\autohotkey-1.1.37.01\\AutoHotkeyU64.exe"
}
```

## Usage

- Double click on `watch.ahk` from the extracted files
- Press F8
- Speak into your microphone what you would like to do
- Press F8
- Wait for Open AI to do its magic

## Customise

Among the extracted files, there is a `prompt.txt`. You can edit this to customise it to yor own needs.

For instance, the current prompt file defaults to using the [DuckDuckGo](https://duckduckgo.com/) search engine. You can change this easily to any search engine you like, by modifying the following line in `prompt.txt`:

```
Unless otherwise specified, assume:
...
- the default search engine is DuckDuckGo
...
```

## Prior Art

- [ChatGPT-AutoHotkey-Utility](https://github.com/kdalanon/ChatGPT-AutoHotkey-Utility): Uses AutoHotKey to perform a number of actions, such as translate

## Develop

### Build Source Code

`task build`

## Package Executable
### Package Executable

`task package`

## Run Locally
### Run Locally

```
go run ./cmd/whisper-autohotkey/.
```
```
1 change: 1 addition & 0 deletions prompt.txt
Original file line number Diff line number Diff line change
@@ -22,5 +22,6 @@ Avoid all logical and syntactical errors. To help you avoid making errors, ALWAY
create a script with the following content:
> MsgBox, 32,,[Your comment]
Replace [Your comment] with your comment. Also include the prompt as you have received it in the comment.
9. If I ask you to Paste something, use the SendInput, {Raw} function.

Now I will provide the ACTION. Please remember, NEVER respond with ANYTHING ELSE but a valid AutoHotKeyScript.
2 changes: 1 addition & 1 deletion script.ahk
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Run, firefox.exe "https://duckduckgo.com/?q=how`%20to`%20create`%20zip`%20file`%20with`%20github`%20actions"
Run, https://www.pexels.com/search/beautiful`%20flowers/
return
17 changes: 11 additions & 6 deletions watch.ahk
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
Capslock::Esc

F8::
Run %A_WorkingDir%\bin\fmedia-1.31-windows-x64\fmedia\fmedia.exe --record --out=rec.mp3 --globcmd=listen,, Hide
NotRecording := !NotRecording
If NotRecording
{
Run %A_WorkingDir%\bin\fmedia-1.31-windows-x64\fmedia\fmedia.exe --record --overwrite --out=rec.mp3 --globcmd=listen,, Hide
}
Else
{
Run %A_WorkingDir%\bin\fmedia-1.31-windows-x64\fmedia\fmedia.exe --globcmd=stop,, Hide
Sleep, 100
Run %A_WorkingDir%\bin\whisper-autohotkey\whisper-autohotkey.exe,, Hide
}
return

F9::
Run %A_WorkingDir%\bin\fmedia-1.31-windows-x64\fmedia\fmedia.exe --globcmd=stop,, Hide
Sleep, 100
Run %A_WorkingDir%\bin\whisper-autohotkey\whisper-autohotkey.exe,, Hide
return

0 comments on commit dfa54ef

Please sign in to comment.