Microsoft’s PowerToys recently received its most significant AI update on Windows 11 (and Windows 10). Windows users already love PowerToys for its collection of handy utilities, and the new update adds an “Advanced Paste” tool to the list, making things even better.
Advanced Paste is an AI-powered tool that can convert the code snippet copied from the clipboard into your preferred programming language. For example, if you have a code snippet in C++ that you want to convert into Python, Advanced Paste can do that for you.
Windows Latest was at the Build 2024 developer conference, where we noticed how Microsoft quickly converted XML into JSON using PowerToys. The company also revealed that using the more advanced version of the feature, it’s possible to convert any popular programming language to your preferred language, but there’s a catch.
PowerToys’ AI-powered copy-and-paste needs your OpenAI API key to function.
To use the feature, you’ll need to open PowerToys > Advanced Paste, turn on the feature, and then manually toggle the Paste with AI option.
This will open a new dialog with quick instructions on where to find the OpenAI API key for ChatGPT. After creating an account on OpenAI, you can enter the API key and save the changes.
Trying the Paste with AI feature in PowerToys
After adding the OpenAI key, you can try the AI-powered feature in Windows 11 by copying a code snippet and pressing the Windows key + Shift + V shortcut.
As shown in the above screenshot, this keyboard shortcut launches a preview pop-up with three default options: Paste as plain text (Ctrl+1), Paste as markdown (Ctrl+2), and Paste as JSON (Ctrl+3).
It will also let you view the clipboard history, which is far more advanced than Windows’ built-in clipboard history.
To convert the code after copying, you can type the “paste as (x language)” command in the magic search bar. This will use OpenAI’s ChatGPT-4o to convert the code. For example, you can type “paste as Python” to convert the copied C++ code into Python.
As shown in the above screenshot, PowerToys will also produce a preview window where you can review the code.
Windows Latest tested the feature with multiple languages, and ChatGPT integration worked without hiccups.
We also used PowerToys Advanced Paste to convert a simple 79-line game code written in Go programming into Python, and it produced accurate results.
If you don’t like the generated output, you can always click the refresh button to regenerate it. When satisfied with the code preview, click the Paste button to insert the formatted code into the IDE window.
You can still format the code into markdown or JSON if you don’t have an API key. Microsoft may bring support for other ways to convert copied content into your preferred programming languages.
This new paste feature in PowerToys will be helpful for developers who frequently paste and convert code while working. However, ChatGPT isn’t always accurate with code snippets, so you’ll still need to double-check the AI-generated code for errors.
Also, Microsoft clarified that the Advanced Paste feature isn’t supposed to do the programming for you.
If you don’t see the feature, you can manually upgrade to PowerToys version 0.81 from GitHub.