-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathExample_Simple.ahk
31 lines (20 loc) · 1.05 KB
/
Example_Simple.ahk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#Include bard.ahk
/*https://github.com/samfisherirl/Google-Bard-for-AHK-v2
For API access (2mins):
Go to https://bard.google.com/
F12 for console Copy the values
Session: Go to Application → Cookies → . Copy the value of that cookie.__Secure-1PSID and paste into session_token
*/
session_token := "xxxxxxxx."
Barder := Bard(session_token)
; instatiate Bard object, writes token to file. Waits for user to make ask or connect to open python exe
response := Barder.singleAsk("Whats the weather like in Fiji?")
MsgBox(response)
; opens connection, asks the question, and upon response the connection to bard is closed. This is slower but less code. It also doesn't require disconnecting.
Barder.Connect()
response := Barder.ask("Whats the average weather in Fiji?")
MsgBox(response)
response := Barder.ask("How can I travel there?")
MsgBox(response)
Barder.Close()
; Connects to bard via python application. stays open until closed, and questions can be concurrent. This is faster for multiple q's as the connection is left open.