- 1 year ago
Windows - Create shortcut that C&P selected text automatically to web app Deepl
To create a Windows shortcut that automatically copies and pastes selected text into a web app like Deepl, you can utilize a combination of scripting and automation tools. Here's a general approach using AutoHotkey:
Install AutoHotkey: Download and install AutoHotkey from the official website (https://www.autohotkey.com/).
Create an AutoHotkey script: Create a new text file with a
.ahk
extension and open it in a text editor. Add the following script:
autohotkey#IfWinActive, ahk_exe YourWebAppExecutable.exe ; Replace with the executable name of your web app
^!d::
Send, ^c
Sleep, 100
Run, https://www.deepl.com/translator#auto/en/%Clipboard%
return
This script defines a hotkey (Ctrl+Alt+D
) that triggers the following actions:
Send, ^c
: Simulates the keyboard shortcut for copying (Ctrl+C
) to capture the selected text.Sleep, 100
: Waits for 100 milliseconds to ensure the copied text is ready to be pasted.Run, https://www.deepl.com/translator#auto/en/%Clipboard%
: Opens the Deepl web app in a browser, automatically pastes the copied text (%Clipboard%
) into the translation field, and translates it from the detected language (auto
) to English (en
).
Save and compile the script: Save the AutoHotkey script, then right-click on it and choose "Compile Script" from the AutoHotkey context menu. This step creates an executable file (.exe) from your script.
Create a shortcut: Right-click on the compiled script (.exe), select "Create Shortcut," and place the shortcut in a convenient location.
Assign a hotkey to the shortcut: Right-click on the shortcut, choose "Properties," and go to the "Shortcut" tab. Set a desired hotkey in the "Shortcut key" field (e.g.,
Ctrl+Alt+D
), and click "Apply" and then "OK."
Now, whenever you press the assigned hotkey (Ctrl+Alt+D
), the selected text will be automatically copied and pasted into Deepl for translation. Remember to replace YourWebAppExecutable.exe
with the actual executable name or window title of your web app.
Note: Keep in mind that this approach assumes the web app has a URL-based mechanism for accepting text input. The script provided here is a basic example and might require adjustments based on your specific web app and its behavior.