Skip to content

Instantly share code, notes, and snippets.

@Vaisakhkm2625
Last active December 1, 2023 18:02
Show Gist options
  • Save Vaisakhkm2625/c8c61ef2fca3a345fb1e28f80bd766d8 to your computer and use it in GitHub Desktop.
Save Vaisakhkm2625/c8c61ef2fca3a345fb1e28f80bd766d8 to your computer and use it in GitHub Desktop.
clipboard type

Type from clipboard

Windows

$wshell = New-Object -ComObject wscript.shell;$txt='';foreach ($element in $(Get-Clipboard)){$element=$element -replace '[+^%~(){}]','{$0}';$element= -join($element,'{ENTER}');echo $element;$txt = -join($txt,$element);};sleep 4; $wshell.SendKeys($txt);

run this in powershell, and within 4 sec, place cursor at where you want to type all out

prettyfiled code

$wshell = New-Object -ComObject wscript.shell;
$txt='';
foreach ($element in $(Get-Clipboard)){
  $element=$element -replace '[+^%~(){}]','{$0}';
  $element= -join($element,'{ENTER}');
  echo $element;
  $txt = -join($txt,$element);
};
sleep 4; $wshell.SendKeys($txt);

Linux

For wayland users

start the ydotoold service as demon (this is for security reason on wayland, )

systemctl start ydotoold; // for socket errors try YDOTOOL_SOCKET='/tmp/.ydotool_socket' ydotool type 'hi'

To type from clipboard

sleep 3;ydotool type $(wl-paste)

To type from file

sleep 4;ydotool type -f <filename>

For x11 users

sleep 4; xdotool type "$(xclip -o -selection clipboard)"

MacOS

For apple users, here is a AppleScript with works the same

delay 4

tell application "System Events" to keystroke (the clipboard as text)

https://stackoverflow.com/a/63468725/15070114

inspired by -
https://christitus.com/clickpaste

@Vaisakhkm2625
Copy link
Author

copy text to clipboard after taking screen shot

x11

flameshot gui --raw | tesseract stdin stdout | xclip -in -selection clipboard

wayland

flameshot gui --raw | tesseract stdin stdout | wl-copy

flameshot-org/flameshot#702 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment