Created
May 13, 2023 01:36
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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