I asked GPT-3 to write AutoHotkey scripts for me. These are it's scripts.

Discuss Autohotkey related topics here. Not a place to share code.
Forum rules
Discuss Autohotkey related topics here. Not a place to share code.
Endif_
Posts: 9
Joined: 19 Mar 2020, 18:15

I asked GPT-3 to write AutoHotkey scripts for me. These are it's scripts.

Post by Endif_ » 26 May 2022, 07:55

The following are some scripts OpenAI's text-DaVinci-002 GPT-3 engine generated upon given English inputs. This engine is fascinating. Doesn't quite get it right all the time, but it wasn't ever specifically trained in AutoHotkey. It learned this all on it's own from browsing the internet. It knows Python much better. Can we get this as a plugin on the Ask For Help forum? :3 It seems like a fantastic auto GUI generator :D

Human: Can you please write me an AutoHotkey script that displays the text "Hello world!" to the user?
AI:

Code: Select all

MsgBox % "Hello world!"
Human: Would you please write me an AutoHotkey script that creates a GUI that covers the entire screen with the color black?
AI:

Code: Select all

#SingleInstance, force
Gui, 1: -Caption +AlwaysOnTop
Gui, 1: Color, 000000
Gui, 1: +Resize
Gui, 1: Show, w%A_ScreenWidth% h%A_ScreenHeight%
return
Human: Would you please write me an AutoHotkey script that checks if a string is a palindrome? (This response didn't work, the AI used a function that doesn't exist and never declared it itself)
AI:

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

StringIsPalindrome(string){
    loop, Parse, string
        if (A_LoopField != StrReversed(A_LoopField))
            return 0
    return 1
}

MsgBox, % StringIsPalindrome("racecar") ? "It's a palindrome!" : "It's not a palindrome."
Human: Can you write me an AutoHotkey script that creates a GUI for the user to input their paycheck amount, tax rates, and hours worked to calculate their wages? (This one is just sloppy understanding of the syntax. I also think the output limit was limiting it from being able to write a whole script. The platform I'm using only has so many characters you can input and output.
AI:

Code: Select all

#NoEnv 
Gui, Add, Text, x10 y10 w100 h30, Enter pay: 
Gui, Add, Edit, x110 y10 w100 h30, 
Gui, Add, Text, x10 y40 w100 h30, Enter tax rates: 
Gui, Add, Edit, x110 y40 w100 h30, 
Gui, Add, Text, x10 y70 w100 h30, Enter hours worked: 
Gui, Add, Edit, x110 y70 w100 h30, 
Gui, Add, Button, x10 y100 w100 h30, Calculate, gButtonCalc

ButtonCalc: 
Gui, Submit, NoHide
pay := GuiControlGet, pay, Edit1
taxrates := GuiControlGet, taxrates, Edit2
hoursworked := GuiControlGet, hoursworked, Edit3
wages := (pay - (taxrates * pay)) * hoursworked
Gui, Add, Text, x10 y130 w100 h30, Your wages are: 
Gui, Add, Text, x110 y130 w100 h30, %wages%
Gui, Show, w200 h160, Wage Calculator
Human: Can you please write me an AutoHotkey function that converts decimal to binary?
AI:

This function converts decimal to binary: ;(The AI actually said this line this time for some reason)

Code: Select all

ToBinary(decimal)
{
	if (decimal <= 0)
		return "0";
	
	binary = "";
	
	while (decimal > 0)
	{
		binary = (decimal % 2).ToString() + binary;
		decimal = decimal / 2;
	}
	
	return binary;
}

User avatar
TheDewd
Posts: 1507
Joined: 19 Dec 2013, 11:16
Location: USA

Re: I asked GPT-3 to write AutoHotkey scripts for me. These are it's scripts.

Post by TheDewd » 26 May 2022, 13:18

Thanks for brining this website to my attention.

Code: Select all

Human: Write a story about Super Mario dying and waking in heaven

AI: When Mario died, he awoke in heaven. He was greeted by a bright light and a beautiful angel. The angel told him that his time on earth was done, and that he must now ascend to the next level. Mario wasn't sure what to make of it, but he soon found himself in a beautiful place with infinite possibilities.

Endif_
Posts: 9
Joined: 19 Mar 2020, 18:15

Re: I asked GPT-3 to write AutoHotkey scripts for me. These are it's scripts.

Post by Endif_ » 26 May 2022, 17:47

The primary reason I wanted to make this post was to share it, hehe. This thing is wild. That Mario story just takes the cake! Bahaha! I really can't tell if that was an intended pun or a happy accident - "ascend to the next level"

One thing to keep in mind, you are given $18 worth of input/output credit upon creation of your account! This means you have limited amount of things you can say and receive from the bot! I did not realize this until it was too late! After you run out of tokens, you cannot use it anymore. Choose your words wisely! (Or bust out that wallet)

ikea
Posts: 1
Joined: 20 Dec 2022, 07:48

Re: I asked GPT-3 to write AutoHotkey scripts for me. These are it's scripts.

Post by ikea » 20 Dec 2022, 07:58

Hi,

I just wanted to post a very similar experience I had this morning.

This quick and simple conversation with Chat GPT below actually created 100 % bulletproof code which works.

You can achieve much more if you combine the basic knowledge of AHK with this neural network power...

This one below is just for awareness.





Q: Write the code to be used in autohotkey software, which does the following: by pressing X, it tests the resolution of my screen and displays this information onscreen

A: Here is the code that you can use in AutoHotkey to display the screen resolution of your monitor when you press the "X" key:

-------------------------

Code: Select all

X::
    ; Get the screen resolution of the primary monitor
    Width := A_ScreenWidth
    Height := A_ScreenHeight

    ; Display the screen resolution onscreen
    ToolTip, The screen resolution is: %Width%x%Height%
    return
--------------------------

This code first gets the width and height of the primary monitor using the A_ScreenWidth and A_ScreenHeight built-in variables, respectively. It then displays the screen resolution on the screen using the ToolTip command, which displays a tooltip window with the specified text.

To use this code, simply copy and paste it into a new AutoHotkey script and save it with a .ahk file extension. Then, run the script using the AutoHotkey executable. When the script is running, you can press the "X" key to display the screen resolution on your monitor.




Q: Add a line of code which makes this tooltip disappear after 3 seconds

A: To make the tooltip disappear after 3 seconds, you can use the SetTimer command in AutoHotkey to create a timer that will hide the tooltip after a specified number of milliseconds. Here is the modified code that includes the timer:

-------------------------

Code: Select all

X::
    ; Get the screen resolution of the primary monitor
    Width := A_ScreenWidth
    Height := A_ScreenHeight

    ; Display the screen resolution onscreen
    ToolTip, The screen resolution is: %Width%x%Height%

    ; Create a timer to hide the tooltip after 3 seconds
    SetTimer, HideTooltip, 3000
    return

; Timer function to hide the tooltip
HideTooltip:
    ToolTip
    return
[Mod edit: [code][/code] tags added.]
-------------------------
In this code, the SetTimer command creates a timer that will run the HideTooltip function after 3,000 milliseconds (3 seconds). The HideTooltip function simply hides the tooltip using the ToolTip command without any arguments.

To use this modified code, simply copy and paste it into a new AutoHotkey script and save it with a .ahk file extension. Then, run the script using the AutoHotkey executable. When the script is running, you can press the "X" key to display the screen resolution on your monitor, and the tooltip will automatically disappear after 3 seconds.

Post Reply

Return to “General Discussion”