Hack Of The Day: Bemused and my 7650 as a PowerPoint XP Remote

Update: see PowerPoint Remote for a compiled package and full source.

I needed a presentation remote, and the obvious way to go about doing things was to use my 7650 to control PowerPoint over Bluetooth. I searched around and, sure enough, there's Bemused.

But I couldn't get Bemused to control PowerPoint XP (it only controls the PowerPoint Viewer, which is crap when it comes to slide transitions and effects), and after looking through the other options, I realized I didn't feel like paying for a half-baked shareware program when Bemused did everything I wanted.

Plus, the Bemused client was the hardest bit by far, and it's free and well maintained. So I fired up Visual Basic, read through the Bemused Protocol Specs and whipped out the following nugget of code to replace the "standard" Bemused server:

Private Sub Comm_OnComm()
  Dim szCommand As String
  Dim szBuffer As Variant

  Select Case Comm.CommEvent
    Case comEvReceive
      szBuffer = Comm.Input
      Debug.Print "Got :[" + szBuffer + "]"
      szCommand = Left$(szBuffer, 4)
      Debug.Print "Parsing Command [" + szCommand + "]"
      Select Case szCommand
        Case "CHCK"
          Send "Y"
        Case "DLST"
          Send "LISTACK" + Chr$(&HF0)
        Case "INFO"
          Send "INFOACK" + Chr$(1) + String$(10, Chr$(0)) + "PowerPoint" + Chr$(0)
        Case "STRT"
          SetCaption "Play"
          SendKeys "{PGDN}"
        Case "PAUS"
          SetCaption "Pause"
          SendKeys "."
        Case "NEXT"
          SetCaption "Next"
          SendKeys "{END}"
        Case "PREV"
          SetCaption "Previous"
          SendKeys "{PGUP}"
        Case "RWND"
          SetCaption "Rewind"
          SendKeys "{HOME}"
        Case "STOP"
          SetCaption "Stop"
          SendKeys "{END}"
      End Select
    Case Else
      Debug.Print "Event " + Str$(Comm.CommEvent)
  End Select
End Sub

Private Sub Send(szOutput As String)
  Debug.Print "Sending '" + szOutput + "'";
  Comm.Output = szOutput
End Sub

Private Sub SetCaption(szString As String)
  Debug.Print szString
  Command.Caption = szString
End Sub

Private Sub Form_Load()
  Comm.CommPort = 8
  Comm.RThreshold = 4
  Comm.PortOpen = True
  Comm.InputLen = 0
  Comm.SThreshold = 1
End Sub

This is, of course, hard-coded to my laptop's Bluetooth COM port and the PowerPoint presentation hotkeys, but works perfectly for me (you need to setup an MSComm OCX named Comm and a couple of labels to get it to run, but any half-competent Visual Basic monkey can do that).

It should also work with the P800 Bemused client or any other Series 60 phone you can get on the market today (like the 3650), and as soon as I clean up the code I'll plonk it up on my CVS server.

No, I don't think there will be a Mac OS X version anytime soon - I use my Mac for actual engineering, not for giving presentations. But hey, it's simple enough for anyone else to re-implement - be my guest.

Mozilla 1.4 is out

'nuff said.