Overview
This prompt aims to generate a functional AutoHotkey v2 script for toggling a feature with the F1 key. Programmers and coders will benefit by quickly implementing a user-friendly toggle feature in their applications.
Prompt Overview
Purpose: This script toggles a feature on and off with the F1 key.
Audience: It is designed for programmers and coders using AutoHotkey v2.
Distinctive Feature: The script includes a persistent overlay showing the current state at the top-left corner.
Outcome: Users can easily see whether the feature is “On” or “Off” while working.
Quick Specs
- Media: Text
- Use case: Generation
- Industry: Cryptocurrency & Blockchain, Development Tools & DevOps, Renewable Energy (Solar, Wind, Hydro)
- Techniques: Zero-Shot Prompting
- Models: Claude 3.5 Sonnet, Gemini 2.0 Flash, GPT-4o, Llama 3.1 70B
- Estimated time: 5-10 minutes
- Skill level: Beginner
Variables to Fill
No inputs required — just copy and use the prompt.
Example Variables Block
No example values needed for this prompt.
The Prompt
Generate an AutoHotkey v2 (AHK2) script that toggles a feature on and off each time the F1 key is pressed.
The script should display a small overlay at the top-left corner of the screen indicating whether the feature is currently “On” or “Off”.
**Details:**
– Pressing F1 toggles the state between “On” and “Off”.
– The overlay must be visible at the top-left corner of the screen.
– The overlay text should clearly show the current state: “On” or “Off”.
– The script must use AHK v2 syntax.
**# Steps**
1. Initialize a variable to keep track of the toggle state.
2. Define a hotkey for F1 that inverts the toggle state.
3. Create or update an overlay GUI window at the top-left corner to display the current state.
4. Ensure the overlay is always on top and does not interfere with other applications.
**# Output Format**
Provide the full valid AHK v2 script, including:
– Clear comments explaining each part of the script.
– Proper formatting for readability.
Screenshot Examples
How to Use This Prompt
- Copy the prompt provided above.
- Open your preferred text editor for scripting.
- Paste the copied prompt into the editor.
- Run the script using AutoHotkey v2.
- Press F1 to toggle the feature on and off.
- Observe the overlay indicating the current state.
Tips for Best Results
- “`ahk
- Initialize the toggle state variable
- toggleState := false
- Create a GUI for the overlay
- Gui, New, +AlwaysOnTop +ToolWindow +Resize -Caption
- Gui, Add, Text, vStateText, Off
- Set initial text to "Off"
- Gui, Show, x0 y0
- Show the GUI at the top-left corner
- Define the F1 hotkey to toggle the state
- F1::
- toggleState := !toggleState
- Invert the toggle state
- Update the overlay text based on the current state
- if (toggleState) {
- GuiControl,, StateText, On
- Change text to "On"
- } else {
- GuiControl,, StateText, Off
- Change text to "Off"
- }
- return
- Ensure the GUI stays on top
- Gui, +AlwaysOnTop
- “`
FAQ
- What is AutoHotkey used for?
AutoHotkey is a scripting language for automating tasks in Windows. - How do you toggle a feature in AHK?
You can toggle a feature by using a hotkey to change a variable's state. - What does F1 do in this script?
Pressing F1 toggles the feature between 'On' and 'Off' states. - Where is the overlay displayed?
The overlay is displayed at the top-left corner of the screen.
Compliance and Best Practices
- Best Practice: Review AI output for accuracy and relevance before use.
- Privacy: Avoid sharing personal, financial, or confidential data in prompts.
- Platform Policy: Your use of AI tools must comply with their terms and your local laws.
Revision History
- Version 1.0 (February 2026): Initial release.


