kdalanon / ChatGPT-AutoHotkey-Utility

An AutoHotkey script that uses ChatGPT API to process text.
GNU General Public License v3.0
76 stars 11 forks source link

two small feature requests #3

Closed michaelbeijer closed 10 months ago

michaelbeijer commented 11 months ago

Hi there! Thanks for the great little app!

Is there any way to do this:

  1. Have the text generated/translated by ChatGPT automatically copied to my clipboard?
  2. Close the pop-up window with the Escape key?
michaelbeijer commented 11 months ago

OK, I solved #2:

/*
====================================================
Hotkey
====================================================
*/

`::MenuPopup.Show()

; Close the response window when the Escape key is pressed
Escape::Close()
michaelbeijer commented 11 months ago

solved #1 as well. I added the following bit to the code:

; Automatically copy the response to the clipboard A_Clipboard := JSON_Response

...
try {
    if (HTTP_Request.status == 200) {
        ...
        JSON_Response := var.Get("choices")[1].Get("message").Get("content")
        RetryButton.Enabled := 1
        CopyButton.Enabled := 1
        Response.Value := JSON_Response

        ; Automatically copy the response to the clipboard
        A_Clipboard := JSON_Response

        ...
    } else {
        ...
    }
}
...
michaelbeijer commented 11 months ago

in the end, it turns out I didn't need: Escape::Close() to close the menu.

Pressing Esc closes it even without Escape::Close()