
I recently gave a talk at the UDEM about How Free Software Can Pay for Itself (Thanks for the title, Andre!), and a wild idea I had was to have each slide Tweet automatically a link to the slide and a short message, as well as the event hashtag.
A quick Google search later, I found an old OpenOffice-Twitter extension, however due to Twitter’s “security” policies, it no longer worked.
Because implementing an OAuth client was just out of scope for something as ridiculous as this, I decided to instead use Greg Kroah-Hartman’s bti, and just hook it up with a Shell Macro.
The end result was this little macro:
Sub PostToTwitter()
Tweet=InputBox(“Your message:”, “Post to Twitter”)T
Shell(“bash -c ‘echo “+Tweet+” | bti’”)
MsgBox (“The message has been posted.”, , “All done!”)
End Sub
This works, though you need to set up a .bti file in ~ with a consumer secret and key, and Twitter’s “security” policies state that I probably shouldn’t post the keys I used, but you can keep a secret, right? Here’s the contents of my bti file
consumer_key=INsLmO6n8wdW4JWJhiP3Ug
consumer_secret=xzI5radv0V9YWyZRLkjOIt0ahHvPuo5wJm6KUelqzo
With that done, try tweeting from the command line. Once you’re sure that it works (You do need to authenticate and type in a pin), you can use the Macro I wrote above and it’ll tweet as “LibreOffice”.
With that done, I really wanted to tweet each slide as I went through them, though LibreOffice, as far as I know, has no way to execute a macro on an open slide presentation, on load…. but here’s what I did:
I created a blank png file, and made it cover the entire slide. I then right-clicked the invisible PNG and once selected, I clicked on “Interaction”. This allows you to configure a Macro, and because we don’t want the Macro up above to popup with “what to Tweet” mid-presentation… I pre-wrote the tweets and assigned each macro to a slide…
Sub IntroTwitter()
Shell(“bash -c ‘Comenzando mi conferencia\, en vivo para el \#IUSL2011 desde la UDEM… Como el Software Libre se puede pagar a sí mismo http://sparkle.k3rnel.net/iusl11/1.png | bti’”)
End Sub
Sub OhYes()
Shell(“bash -c ‘Free es libre. Free es gratis. Que palabra tan dificil… \#IUSL2011 http://sparkle.k3rnel.net/iusl11/2.png | bti ‘”)
End Sub
Here’s a couple of considerations:
- If you have animations (I had some stuff set to appear on click), you won’t be able to “click” the slide to advance through it.
- The keyboard keys left and right do work, and so does space bar and the Macro won’t be triggered this way
- If you’re using the libreoffice-screen-presenter (It’s awesome, you should), make sure you have your mouse over the slide and not on the screen-presenter.
- If you’re using a Wii-Remote as a remote controller, I suggest you set A and B as left-and-right on the keyboard, and in my case I used Dpad-Down as left click, but you could use the Home button and prevent accidental mis-tweets.
- When writing the macro, remember that using echo, certain ASCII letters need to be escaped, such as , and #, for the command to work.
- Instead of Twitter, you could use Identi.ca or any other Status.net server as long as bti supports it.
- You require an Internet connection to tweet. I didn’t have access to the Internet when I started my presentation, and therefore, my experiment was pretty useless.
If you found this useful or have a way to improve on it, please let me know. I had a lot of fun putting all the pieces together and thought this might help someone else.