Tinderbox User-to-User Forum (for formal tech support please email: info@eastgate.com)
http://www.eastgate.com/Tinderbox/forum//YaBB.cgi
Tinderbox Users >> Agent, Actions, Rules & Automation >> Action code to clear the clipboard
http://www.eastgate.com/Tinderbox/forum//YaBB.cgi?num=1348774309

Message started by Sumner Gerard on Sep 27th, 2012, 3:31pm

Title: Action code to clear the clipboard
Post by Sumner Gerard on Sep 27th, 2012, 3:31pm

I want a Stamp I can apply to clear the clipboard. After a search I found this:


Code:
echo -n '' | pbcopy


That works well from the command line on my system.

BUT the following does not work as expected:


Code:
runCommand("echo -n '' | pbcopy")


That clears everything and leaves "-n"  and a trailing newline character in the clipboard.

If I remove the -n option, the clipboard clears but the trailing newline character remains, as expected per man echo.

I've tried escaping, switching single and double quotes, putting the string in a code note, etc. not really knowing what I'm doing but figuring no harm in trying. But I can't get it to work. runCommand() seems just too smart (or confused?) in this case, or maybe it just doesn't support the -n option.

Would appreciate help! ... If there's a more runCommand()-friendly approach than this particular one, that would be fine too.



Title: Re: Action code to clear the clipboard
Post by Mark Anderson on Sep 27th, 2012, 4:29pm

Try the stamp action:

runCommand("pbcopy < /dev/null")

Found via Google, here. Tests OK for me in TB v5.11.2.

Title: Re: Action code to clear the clipboard
Post by Sumner Gerard on Sep 27th, 2012, 4:53pm

Yes, that works nicely. Thanks!

Tinderbox User-to-User Forum (for formal tech support please email: info@eastgate.com) » Powered by YaBB 2.2.1!
YaBB © 2000-2008. All Rights Reserved.