Simplify dialog with ChatGPT

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
User avatar
Krutstugan
Posts: 22
Joined: 26 May 2021, 09:56

Simplify dialog with ChatGPT

05 Apr 2023, 19:01

Hi. I want a shortcut that copies marked text and feeds it back into ChatGPT and clicks enter.
Hitting tab x times is one way. However, the number of tabs are different each time.
Any ideas how to jump to the text input field shown below?
image.png
image.png (44.77 KiB) Viewed 925 times
joyrr5092
Posts: 83
Joined: 28 Dec 2023, 09:54

Re: Simplify dialog with ChatGPT

03 Mar 2024, 16:19

python + selenium would be better,

but in the land of ahk, there is a chrome.ahk library.
User avatar
gregster
Posts: 9224
Joined: 30 Sep 2013, 06:48

Re: Simplify dialog with ChatGPT

03 Mar 2024, 22:43

joyrr5092 wrote:
03 Mar 2024, 16:19
python + selenium would be better,

but in the land of ahk, there is a chrome.ahk library.
For reference, besides Chrome.ahk, it is also possible to use AHK with Selenium (although not overly popular, I guess). Or you could use instead Rufaydium. Or possibly some kind of javascript injection (like eg teadrinker has shown in the past).
william_ahk
Posts: 639
Joined: 03 Dec 2018, 20:02

Re: Simplify dialog with ChatGPT

04 Mar 2024, 00:46

No one's mentioning the amazing UIA_Interface.ahk? It's much simpler than all above.
User avatar
gregster
Posts: 9224
Joined: 30 Sep 2013, 06:48

Re: Simplify dialog with ChatGPT

04 Mar 2024, 00:56

Yeah, might be sufficient for this use case. I still haven't used UIA yet, but afaik the specialized tools can do more advanced browser automation (headless mode, automating inactive tabs, ...).
If that's needed here, or if this is all about working on an active tab, we don't really know yet. If it's about the active tab, teadrinker's technique (look for RunJsFromChromeAddressBar() or similar) might actually be the easiest solution. I think it uses Acc (accessibility) functions, so it's loosely related to UIA. Not sure, if a v2 version has been posted yet.
william_ahk
Posts: 639
Joined: 03 Dec 2018, 20:02

Re: Simplify dialog with ChatGPT

04 Mar 2024, 01:27

To be honest, it's sufficient for most of the use cases. Average users just need to automate the browser like they automate the desktop.

I've used RunJsFromChromeAddressBar quite intensively in the past and loved it. Unfortunately it needs updating recently because Chromium browsers no longer expose the address bar to Acc and we now have to use UIAutomation to control the address bar anyway. Also writing the Javascript to evaluate is more complicated than writing UIA commands. Not to mention Descolada's UIAViewer provides a macro creator which generates those commands for you. UIA should be the first choice for new users.
User avatar
gregster
Posts: 9224
Joined: 30 Sep 2013, 06:48

Re: Simplify dialog with ChatGPT

04 Mar 2024, 01:35

Thank you, good to know :thumbup:
joyrr5092
Posts: 83
Joined: 28 Dec 2023, 09:54

Re: Simplify dialog with ChatGPT

04 Mar 2024, 09:18

ahk is NOT popular, and a small niche in it is EVEN more less popular. (not unpopular)
Phinnnty
Posts: 7
Joined: 19 Jul 2024, 06:52
Contact:

Re: Simplify dialog with ChatGPT

29 Jul 2024, 10:41

Did you figure it out?
User avatar
xMaxrayx
Posts: 352
Joined: 06 Dec 2022, 02:56
Contact:

Re: Simplify dialog with ChatGPT

30 Jul 2024, 05:06

william_ahk wrote:
04 Mar 2024, 01:27
To be honest, it's sufficient for most of the use cases. Average users just need to automate the browser like they automate the desktop.

I've used RunJsFromChromeAddressBar quite intensively in the past and loved it. Unfortunately it needs updating recently because Chromium browsers no longer expose the address bar to Acc and we now have to use UIAutomation to control the address bar anyway. Also writing the Javascript to evaluate is more complicated than writing UIA commands. Not to mention Descolada's UIAViewer provides a macro creator which generates those commands for you. UIA should be the first choice for new users.
just use chrome extinction that put URL in chrome title, used for ages and never break, also good for vanilla Keepass
-----------------------ヾ(•ω•`)o------------------------------
https://github.com/xmaxrayx/
william_ahk
Posts: 639
Joined: 03 Dec 2018, 20:02

Re: Simplify dialog with ChatGPT

30 Jul 2024, 10:42

Phinnnty wrote:
29 Jul 2024, 10:41
Did you figure it out?
Using UIA, it's really simple.

Code: Select all

#Requires AutoHotkey v2.0
#SingleInstance Force
#Include UIA.ahk
F1::
{
	W := WinExist("ahk_class Chrome_WidgetWin_1")
	W := UIA.ElementFromHandle(W)
	PromptTextArea := W.WaitElement({AutomationId: "prompt-textarea"})
	PromptTextArea.Invoke()
	;PromptTextArea.Value := "Guten tag"
}

xMaxrayx wrote:
30 Jul 2024, 05:06
just use chrome extinction that put URL in chrome title, used for ages and never break, also good for vanilla Keepass
What do you mean?
Phinnnty
Posts: 7
Joined: 19 Jul 2024, 06:52
Contact:

Re: Simplify dialog with ChatGPT

30 Jul 2024, 12:08

You can also use

Code: Select all

OpenChatGPTWithQuery() {
        Run("https://chat.openai.com/chat?q=" . A_Clipboard )
      }
This function uses a URL where anything following chat?q= will be pasted into the text chat.

You can highlight anything activate the function and it will be pasted into the text chat as a new conversation.

Otherwise I think UIAutomation would be the best bet if you want to use it with already open GPT chats.
Last edited by Ragnar on 30 Jul 2024, 12:37, edited 1 time in total.
Reason: code tags

Return to “Ask for Help (v2)”

Who is online

Users browsing this forum: Bing [Bot], DavidP, FanaticGuru, mikeyww, TomDonovan and 108 guests