Skip to content

Commit fc27933

Browse files
committed
New AI feature
Added Hey Chat VBS
1 parent 722cdd8 commit fc27933

File tree

8 files changed

+356
-34
lines changed

8 files changed

+356
-34
lines changed

Config.ini

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
https://api.openai.com/v1/chat/completions
2+
Enter your API key on this line.
3+
gpt-3.5-turbo
4+
0.75
5+
-
6+
JAHNVIS: Welcome! I'm your AI assistant. How may I assist you today?
7+
Response with "JAHNVIS:"

HeyQuickKeyboard.exe

1 KB
Binary file not shown.

README.md

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Hey Quick Keyboard v1.1
1+
# Hey Quick Keyboard v1.2
22

33
Hey Quick Keyboard is an AutoHotkey script that adds useful shortcuts and improves computer usability on Windows. With this script, you can use the numpad keys, tab keys, screenshot key, power keys, mouse keys, and more with different key combinations on your keyboard. For laptop users, it allows effortless navigation in 3D modeling software through keyboard shortcuts that simulate mouse middle-click and numpad functions.
44

@@ -16,6 +16,7 @@ Hey Quick Keyboard is an AutoHotkey script that adds useful shortcuts and improv
1616
- For power operations, Win + F1 opens hibernate timer, Win + F2 opens restart timer, Win + F3 opens sleep timer, Win + F4 opens shutsdown timer and Win + F6 opens logout timer.
1717
- For mouse operations, you can use the Menu Key as a middle click and Left Alt + arrow keys as a scroll wheel for mouse operations. To move the mouse, use RCtrl + Arrows. To click, use RCtrl + Z for left click, RCtrl + Y for middle click, and RCtrl + C for right click.
1818
- You can turn off the screen witg Win + F12 and turn it on with Win + ESC.
19+
- You can quickly ask questions to the AI ​​with Windows + C via [Hey Chat VBS](https://github.com/JahnStar/Hey-Chat-VBS) and play a role in MsgBox.
1920

2021
## Installation
2122

@@ -28,44 +29,47 @@ You can find all the shortcuts that this script provides in the [Shortcuts](#sho
2829
## Hotkeys
2930

3031
| Key Combination | Function | Action |
31-
| --------------- | -------- | ------ |
32-
| **Numpad** | Emulate the numpad keys | Type numbers or symbols |
33-
| Win + CapsLock | Suspend | Toggle the script on or off |
34-
| 0-9 (without Shift, Win or AltrGr) | Numpad 0-9 | Type numbers from 0 to 9 |
35-
| Alt + . | Numpad . | Type a decimal point |
36-
| Alt + / | Numpad / | Type a division sign |
37-
| Alt + - | Numpad - | Type a subtraction sign |
38-
| Alt + , | Numpad + | Type an addition sign |
39-
| Ctrl + - | Ctrl + Numpad - | Zoom out |
40-
| Ctrl + , | Ctrl + Numpad + | Zoom in |
41-
| **Tab** | Switch between windows or tabs | Cycle through open applications or browser tabs |
42-
| Pause | Ctrl + Shift + Tab | Switch and display windows |
43-
| PgUp | Alt + Tab | Switch to the previous window |
44-
| PgDn | Alt + Shift + Tab | Switch to the next window |
45-
| **Screenshot** | Capture the screen or a part of it | Save or copy an image of the screen |
46-
| PrtSc | Win + PrtSc | Take a screenshot and save it in the Pictures folder |
47-
| Ctrl + PrtSc | PrtSc | Take a screenshot and copy it to the clipboard |
48-
| **Windows** | Manage windows or tasks | Close, restart, or clear windows or processes |
32+
| ---- | ---- | ---- |
33+
| **-Windows-** | Manage windows or tasks | Close, restart, or clear windows or processes |
34+
| Win + C | Ask AI with [Hey Chat VBS](https://github.com/JahnStar/Hey-Chat-VBS) | Quickly ask the selected text and speak to the AI |
35+
| Win + S | Text to Speech | Speech selected text using Narrator |
4936
| Win + F | Quick Search | Search selected text on google |
5037
| Win + T | Quick Translate | Translate selected text with google translate |
5138
| Ctrl + Alt + F4 | Taskkill | Force quit the current window or application |
5239
| Win + F5 | Restart Explorer | Restart the Explorer to refresh the desktop and taskbar |
5340
| Win + F5 (As Admin) | Clear Temp Files (As Admin) | Delete temporary files with [Clear-TempFiles.ps1](https://github.com/Bromeego/Clean-Temp-Files/) |
5441
| Win + F12 | Turn off the display | Lock and turn screen off |
5542
| Win + ESC | Turn on the display | Unlock and turn screen on |
56-
| **Power** | Set a timer for power options | Apply power actions after a specific time |
43+
| **-Power-** | Set a timer for power options | Apply power actions after a specific time |
5744
| Win + F1 | Hibernate Timer | Set a timer to Hibernate after a specified time |
5845
| Win + F2 | Restart Timer | Set a timer to Restart after a specified time |
5946
| Win + F3 | Sleep Timer | Set a timer to Sleep after a specified time |
6047
| Win + F4 | Shutdown Timer | Set a timer to Shutdown after a specified time |
6148
| Win + F6 | Logout Timer | Set a timer to Logout after a specified time |
62-
| **Mouse** | Emulate the mouse buttons or wheel | Click or scroll with the keyboard |
49+
| **-Tab-** | Switch between windows or tabs | Cycle through open applications or browser tabs |
50+
| Pause | Ctrl + Shift + Tab | Switch and display windows |
51+
| PgUp | Alt + Tab | Switch to the previous window |
52+
| PgDn | Alt + Shift + Tab | Switch to the next window |
53+
| **-Screenshot-** | Capture the screen or a part of it | Save or copy an image of the screen |
54+
| PrtSc | Win + PrtSc | Take a screenshot and save it in the Pictures folder |
55+
| Ctrl + PrtSc | PrtSc | Take a screenshot and copy it to the clipboard |
56+
| **-Numpad-** | Emulate the numpad keys | Type numbers or symbols |
57+
| Win + CapsLock | Suspend | Toggle the script on or off |
58+
| 0-9 (without Shift, Win or AltrGr) | Numpad 0-9 | Type numbers from 0 to 9 |
59+
| Alt + . | Numpad . | Type a decimal point |
60+
| Alt + / | Numpad / | Type a division sign |
61+
| Alt + - | Numpad - | Type a subtraction sign |
62+
| Alt + , | Numpad + | Type an addition sign |
63+
| Ctrl + - | Ctrl + Numpad - | Zoom out |
64+
| Ctrl + , | Ctrl + Numpad + | Zoom in |
65+
| **-Mouse-** | Emulate the mouse buttons or wheel | Click or scroll with the keyboard |
6366
| RCtrl + Arrows | Mouse movement | Move the mouse cursor with the arrow keys |
6467
| RCtrl + M | Jump to the Middle | Move the mouse cursor in the middle |
6568
| RCtrl + Z | Left Click | Perform a mouse left click |
6669
| RCtrl + Y / Menu Key | Middle Click | Perform a mouse middle click |
6770
| RCtrl + C | Right Click | Perform a mouse right click |
6871
| Ctrl + Alt + Up/Down Arrow | Scroll Wheel | Scroll up or down |
72+
| | | |
6973

7074
## Contact
7175

other/hey-chat-vbs/Hey-Chat-VBS.vbs

Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
'***************************************************************************************************
2+
' Script: Hey-Chat-VBS v1 (29.12.2023)
3+
' Author: Halil Emre Yildiz
4+
' GitHub: @JahnStar
5+
' Description: Hey Chat VBS is a simple chatbot that uses OpenAI API via Windows Script Host.
6+
'***************************************************************************************************
7+
8+
Dim fso, file, endpoint, apiKey, model, randomness, voice, prompt
9+
Set fso = CreateObject("Scripting.FileSystemObject")
10+
Set file = fso.OpenTextFile("config.ini", 1) ' 1 means ForReading
11+
endpoint = file.ReadLine
12+
apiKey = file.ReadLine
13+
model = file.ReadLine
14+
randomness = file.ReadLine
15+
voice = file.ReadLine
16+
Do Until file.AtEndOfStream
17+
prompt = prompt & file.ReadLine & vbCrLf
18+
Loop
19+
file.Close
20+
21+
Dim WshShell
22+
Set WshShell = CreateObject("WScript.Shell")
23+
If apiKey = "" or apiKey = "Enter your API key on this line." Then
24+
WshShell.Run "config.ini"
25+
WshShell.Run "https://platform.openai.com/api-keys"
26+
WScript.Quit
27+
End if
28+
29+
Dim requestBody, firstMessage, message
30+
firstMessage = Split(prompt, vbCrLf)(0)
31+
Speak firstMessage, voice
32+
33+
message = FixedInputBox(firstMessage & vbCrLf & vbCrLf & "You:", "")
34+
If IsEmpty(message) Or message = "" Then
35+
WScript.Quit
36+
End If
37+
38+
Dim request, responseContent
39+
Set request = CreateObject("Microsoft.XMLHTTP")
40+
41+
Dim messages
42+
messages = Array(Array("system", "[You are an AI assistant who can role-play, developed by Halil Emre Yildiz (AKA Jahn Star) and you are running in VBScript. [Github](https://github.com/JahnStar)]" & Replace(Replace(prompt, """", "'"), vbCrLf, "\n")), Array("user", message))
43+
44+
Do While True
45+
46+
requestBody = "{""model"": """ & model & """, ""messages"": [" & WrapMessages(messages, true) & "], ""temperature"": " & randomness & "}"
47+
48+
On Error Resume Next
49+
50+
request.Open "POST", endpoint, False
51+
request.setRequestHeader "Content-Type", "application/json"
52+
request.setRequestHeader "Authorization", "Bearer " & apiKey
53+
request.send requestBody
54+
55+
If Err.Number <> 0 Then
56+
MsgBox "An error occurred: " & Err.Description & vbCrLf & "Please report the issue by visiting:" & vbCrLf & _
57+
"https://github.com/JahnStar/Hey-Chat-VBS/issues", vbError, "Error"
58+
End If
59+
60+
On Error GoTo 0
61+
62+
If request.Status = 200 Then
63+
' get response
64+
responseContent = ParseJSON(request.responseText, "content")
65+
' add to messages
66+
ReDim Preserve messages(UBound(messages) + 1)
67+
messages(UBound(messages)) = Array("assistant", Replace(responseContent, vbCrLf, "\n"))
68+
' tts
69+
If Left(message, 1) = "-" And voice = "-" Then voice = 0
70+
Speak responseContent, voice
71+
' continue or quit
72+
message = FixedInputBox(responseContent & vbCrLf & vbCrLf & "You:", "")
73+
If IsEmpty(message) Or message = "" Then
74+
' copy log to clipboard
75+
ShowConversationLogs(messages)
76+
WScript.Quit
77+
Else
78+
ReDim Preserve messages(UBound(messages) + 1)
79+
messages(UBound(messages)) = Array("user", message)
80+
End If
81+
Else
82+
MsgBox "Error Log: " & vbCrLf & ParseJSON(request.responseText, "message") & vbCrLf & vbCrLf & "If you think it's a mistake, please report the issue by visiting:" & vbCrLf & _
83+
"https://github.com/JahnStar/Hey-Chat-VBS/issues", vbCritical, ParseJSON(request.responseText, "code") & " error: " & request.Status
84+
ShowConversationLogs(messages)
85+
WScript.Quit
86+
End If
87+
Loop
88+
89+
Function Speak(text, voice)
90+
If voice <> "-" Then WshShell.Run "tts.vbs """ & Split(text, ":")(1) & """ " & voice
91+
End Function
92+
93+
Function ShowConversationLogs(messages)
94+
Dim logs
95+
logs = Replace(WrapMessages(messages, False), "\n", vbCrLf)
96+
InputBox "Conversation Ended: " & vbCrLf & vbCrLf & "```" & vbCrLf & logs & vbCrLf & "```" & vbCrLf & "Press CTRL+C to copy the conversation logs:", "Hey ChatVBS v1 <Github/JahnStar>", logs
97+
End Function
98+
99+
Function WrapMessages(messages, toJson)
100+
Dim json, i
101+
For i = 0 To UBound(messages)
102+
Dim role, content
103+
role = messages(i)(0)
104+
content = messages(i)(1)
105+
106+
If (toJson = True) Then
107+
json = json & "{""role"": """ & role & """, ""content"": """ & content & """}"
108+
If i < UBound(messages) Then
109+
json = json & ", "
110+
End If
111+
Else
112+
If role <> "system" Then
113+
If role <> "user" Then
114+
role = "- (AI) "
115+
Else
116+
role = "- You: "
117+
End If
118+
json = json & role & content & vbCrLf
119+
End If
120+
End If
121+
Next
122+
WrapMessages = json
123+
End Function
124+
125+
Function ParseJSON(jsonString, key)
126+
Dim startPos, endPos, keyPos, valueStartPos, valueEndPos
127+
Dim keyValue, valueStr
128+
129+
' Replace escaped characters
130+
jsonString = Replace(jsonString, "\""", "'")
131+
jsonString = Replace(jsonString, "\\", "\")
132+
jsonString = Replace(jsonString, "\n", vbCrLf)
133+
134+
startPos = InStr(jsonString, """" & key & """") ' Start position of the switch
135+
keyPos = InStr(startPos, jsonString, ":") ' Position of the ":" character of the key
136+
137+
If keyPos > 0 Then
138+
valueStartPos = InStr(keyPos, jsonString, """") + 1 ' Start position of the value
139+
valueEndPos = InStr(valueStartPos, jsonString, """") ' End position of value
140+
141+
valueStr = Mid(jsonString, valueStartPos, valueEndPos - valueStartPos) ' Value string
142+
ParseJSON = valueStr ' Return value
143+
Else
144+
ParseJSON = "" ' Return empty string if key not found
145+
End If
146+
End Function
147+
148+
Function FixedInputBox(message, default)
149+
message = InputBox(message, "Hey ChatVBS v1 <Github/JahnStar>", default)
150+
message = Replace(message, """", "'")
151+
message = Replace(message, "\""", "'")
152+
message = Replace(message, "\\", "\")
153+
FixedInputBox = Replace(message, "\n", vbCrLf)
154+
End Function
155+
156+
' Request example:
157+
' {
158+
' "model": "gpt-3.5-turbo",
159+
' "messages": [
160+
' {
161+
' "role": "system",
162+
' "content": "You are a helpful assistant."
163+
' },
164+
' {
165+
' "role": "user",
166+
' "content": "Hello!"
167+
' },
168+
' "temperature": 0.7
169+
' ]
170+
' }
171+
' Response example:
172+
' {
173+
' "id": "chatcmpl-123",
174+
' "object": "chat.completion",
175+
' "created": 1677652288,
176+
' "model": "gpt-3.5-turbo-0613",
177+
' "system_fingerprint": "fp_44709d6fcb",
178+
' "choices": [{
179+
' "index": 0,
180+
' "message": {
181+
' "role": "assistant",
182+
' "content": "\n\nHello there, how may I assist you today?",
183+
' },
184+
' "logprobs": null,
185+
' "finish_reason": "stop"
186+
' }],
187+
' "usage": {
188+
' "prompt_tokens": 9,
189+
' "completion_tokens": 12,
190+
' "total_tokens": 21
191+
' }
192+
' }

other/hey-chat-vbs/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 Halil Emre Yildiz
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

other/hey-chat-vbs/README.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# HeyChatVBScript
2+
3+
HeyChatVBScript is an AI chat bot developed using VBScript. This bot responds to user inputs using OpenAI's GPT models.
4+
5+
## Installation
6+
7+
1. Clone or download this repository.
8+
2. Open the `config.ini` file and enter your OpenAI API key, adjust the model and temperature values, and enter your prompt.
9+
3. `config.ini` file guide:
10+
1. API endpoint URL
11+
2. API key
12+
3. API model name
13+
4. API temperature value
14+
5. TTS voice index (default: disabled "-")
15+
6. AI's welcome message
16+
7. Enter your prompt starting from this line and in the subsequent lines.
17+
18+
## Usage
19+
20+
1. Run the `HeyChatVBScript.vbs` file.
21+
2. Enter a message to the chat bot.
22+
3. Wait for the bot's response.
23+
4. Continue the conversation by clicking the `OK` button.
24+
5. To end the conversation and view the conversation log , click the `Cancel` button.
25+
26+
## License
27+
28+
MIT License
29+
30+
Copyright (c) 2023 Halil Emre Yildiz
31+
32+
Permission is hereby granted, free of charge, to any person obtaining a copy
33+
of this software and associated documentation files (the "Software"), to deal
34+
in the Software without restriction, including without limitation the rights
35+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
36+
copies of the Software, and to permit persons to whom the Software is
37+
furnished to do so, subject to the following conditions:
38+
39+
The above copyright notice and this permission notice shall be included in all
40+
copies or substantial portions of the Software.
41+
42+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
43+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
44+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
45+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
46+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
47+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
48+
SOFTWARE.

0 commit comments

Comments
 (0)