Digiguide

From XAP Automation
Jump to: navigation, search

I use DigiGuide and xAP to change channel on my TV. There's a simple scripting plugin for DigiGuide that lets you call a vbscript or jscript. This is handy because it means you don't have to mess with the DigiGuide API just use simple script.

The script plugin .ini file lets you add events and context menu items. I just use a 'change channel' menu item on the channel bar. I compose the xAP messages in vbscript and then shell out to Stuart B's ((xAP send)) utility. xAP messages are picked up by Stuart's ((RedRat)) connector. I run digiguide on a laptop that's generally lives on the coffe table - the red rat is on another PC which feeds into my wired IR distribution.

The Digiguide scripting plugin (DG script) is at: http://freespace.virgin.net/julian.cable/DGscript.html

The send program, xAP RedRat Connector etc are at: www.xapframework.net


My script is pasted below. I have a line in the scripting.ini fle to call it from the channel menu:

~np~[ChannelMenu]~/np~

Menu0=Select channel on Sky box

Edward

Code

Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim argv, chanNo, digits, i, digit
Dim fso, f, shell, network, host

Set argv = WScript.Arguments
Set fso = CreateObject("Scripting.FileSystemObject")
Set shell = WScript.CreateObject("WScript.Shell")
Set f = fso.OpenTextFile("tune.xap", ForWriting, True)
Set network = WScript.CreateObject("WScript.Network")

host = lcase(network.ComputerName)

chanNo = argv(1)

digits = len(chanNo)

StartXAPScript f

for i = 1 to digits
 digit = mid(chanNo, i, 1)
 WriteXAPScriptBody f, "Sky+", CStr(digit)
next

EndXAPScript f

shell.Run "tune.xap", 2, true

fso.DeleteFile("tune.xap")

Sub StartXAPScript(f)
f.writeline "xap-header"
f.writeline "{"
f.writeline "    v=12"
f.writeline "    hop=1"
f.writeline "    uid=FF123400"
f.writeline "    class=IR.Transmit"
f.writeline "    source=ersp.digiGuide." + host
f.writeline "}"
End Sub

Sub WriteXAPScriptBody(f, device, signal)
f.writeline "IR.Signal"
f.writeline "{"
f.writeline "    device=" + device
f.writeline "    signal=" + signal
f.writeline "}"
End Sub

Sub EndXAPScript(f)
f.Close
End Sub