Copilot - Gemini Promts

Discussion, questions and support.
Post Reply
aazzoma
Posts: 2
Joined: Apr 8th, ’24, 02:10

Post by aazzoma » Apr 8th, ’24, 02:20

Hello all
Kindly I need a code /ahk to do the following:

when highlighting a text and pressing the shortcut, pop up appears to Choose some prompts to send to GPT (copilot / or Gemmin)

https://copilot.microsoft.com/

or

https://aistudio.google.com/


the prompts:
1- define/explain the highlighted term
2- Translate into (Language - Arabic)
3- suggest synonyms with examples of use


Best Regard.
aazzoma
Posts: 2
Joined: Apr 8th, ’24, 02:10

Post by aazzoma » Apr 8th, ’24, 14:36

what is wrong with this script:

Code: Select all

; Example AHK script to achieve the desired functionality
; When Ctrl+F6 is pressed while text is highlighted, a menu pops up with prompts to choose from

^F6::
    ; Get the highlighted text
    Clipboard := ""
    Send ^c
    ClipWait, 1

    ; If text is not empty, show the menu
    if (Clipboard != "")
    {
        Menu, MyMenu, Add, Define/Explain the highlighted term, DefineExplain
        Menu, MyMenu, Add, Translate the highlighted into (Language - Arabic), TranslateArabic
        Menu, MyMenu, Add, Suggest synonyms of the highlighted, Synonyms
        Menu, MyMenu, Show
    }
return

DefineExplain:
    ; Send the prompt to Copilot
	Run, https://copilot.microsoft.com/
    SendInput define/explain the highlighted term
return

TranslateArabic:
    ; Send the prompt to Copilot
	Run, https://copilot.microsoft.com/
    SendInput Translate the highlighted into (Language - Arabic)
return

Synonyms:
    ; Send the prompt to Copilot
	Run, https://copilot.microsoft.com/
    SendInput suggest synonyms of the highlighted with examples of use
return
User avatar
Tom
Posts: 804
Joined: Nov 24th, ’15, 23:39

Post by Tom » Apr 9th, ’24, 17:29

Try this. You may need to adjust some parts if needed.

Code: Select all

^F6::
Clipboard := ""
Send ^c
ClipWait, 1
if (Clipboard = "")
	return
f:=["Define/Explain this term: ","Translate this text into (Language - Arabic): ","Suggest synonyms of this term: "]
Menu, MyMenu, UseErrorLevel
Menu, MyMenu, Delete
Loop 3
	Menu, MyMenu, Add, % f[A_index], Handler 
Menu, MyMenu, Show
return

Handler:
Run, https://copilot.microsoft.com/
sleep 2000
WinGetPos, X, Y, Width, Height, A
MouseMove, 350, Height-140  ;you may need to adjust 
Click
Send, % A_ThisMenuItem """" Clipboard """"
Send {Enter}
return
Post Reply