Skip to content

Instantly share code, notes, and snippets.

@jjb
Created May 13, 2023 01:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jjb/130df9c281ff265c3e12a07463703f71 to your computer and use it in GitHub Desktop.
Save jjb/130df9c281ff265c3e12a07463703f71 to your computer and use it in GitHub Desktop.
in MacOS, temporarily set the clipboard to something, and then set it back, using ruby
old=`pbpaste`
`echo '#{ENV['THE_TEXT']}' | pbcopy`
3.downto(0) do |second|
`osascript -e 'display notification "Reseting clipboard in #{second} seconds" with title "TMP Clipboard"'`
sleep 1
end
`echo '#{old}' | pbcopy`
THE_TEXT='new text' ruby tmp-clipboard.rb &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment