DGScript

By Julian Cable and John Hind.

Purpose

DGScript is a generic add-in for the DigiGuide EPG (version 4 or above) which enables functionality to be added using scripting techniques rather than C++. It is typically used to add menu items for automatically starting programme viewers or recorders.

If you want to automate lots of things you might prefer my Girder addin instead.

Installation

  1. Get DigiGuide
  2. Get DGscript1.5 or DGscript1.5a or DGscript1.5a compiled in 2004
  3. Copy the following files into the DigiGuide programme directory (usually C:\Program Files\DigiGuide\):
  4. DGScript.dgaddin The add-in dynamic link library (program).
    scripting.ini Example configuration file. Edit to specify your own scripts.
    *.vbs Example scripts used by scripting.ini, see below.
  5. Customise your scripting.ini file.

NOTE: USING OnNow WILL CAUSE LARGE NUMBERS OF WINDOWS TO POP UP WHILE DIGIGUIDE IS RUNNING. WE SUGGEST YOU DO NOT USE AN OnNow SCRIPT.

scripting.ini

The scripting.ini file is provided because, although ini files are obsolete, its easier to edit an ini file than a registry key. The ini file allows you to specify what external programs are called for Digiguide events and what context sensitive menus you want.

DigiGuide Section

This section defines programs to be run and global parameters.

[DigiGuide]
OnStartup Specifies a script to run when DigiGuide is started.
OnShutdown Specifies a script to run when DigiGuide is closed.
OnUpdate Specifies a script to run every minute when DigiGuide is running.
SendDescription Yes adds the description to the command line. Absent or anything else behaves like previous versions.
SavePath Specifies a path to be used to store SaveDescription files.

OnProgramme Section

This section defines programs to be run for Digiguides programme events.

[OnProgramme]
ReminderFired Specifies a program to run when a DigiGuide reminder event occurs.
Start Specifies a program to run when a programme start event occurs.
End Specifies a program to run when a programme end event occurs.
OnNow DigiGuide creates an event every minute for each programme currently showing in any configured channel. Generates a large cascade which can crash your machine! Consider using the marker specific version below.
SaveDescription Specifes when a progamme description file should be written:
any combination of the characters 'R', 'S' and the digits '0'..'9'.

Programme Event Sections

These sections allow marker specific events to be sent. Use the marker number as the key and the event as the value.

[ReminderFired] Specifies a program to run when a DigiGuide reminder event occurs.
[Start] Specifies a program to run when a programme start event occurs.
[End] Specifies a program to run when a programme end event occurs.
[OnNow] DigiGuide creates an event every minute for each programme currently showing in any configured channel.

Marker Types are determined by the Digiguide template files but these are standard:

1 Favourite
2 Reminder
4 Video
5 Watch
6 Category
2147483646 Manually Created

The example shows setting a program to be run if the Favorite Marker ( 1 ) is attached to a programme when it starts.

[Start]
1=wscript notify.vbs StartFavorite

Context Menu Sections

These sections allow menu items to be added to the Digiguide Context Menus. In these sections, X = 0..9. Keys must be used in order and in pairs.

[ChannelMenu]
MenuX Specifies the text for the channel context menu item.
CommandX Specifies a program to run when the menu item is clicked. The special program DGScript (case-insensitive) is implemented internally to show an about dialog.

[ProgrammeMenu]
MenuX Specifies the text for the programme context menu item.
CommandX Specifies an event to send when the menu item is clicked.

Command Line Parameters

The script specifications above are actually Windows Command Lines. To run a script specify wscript.exe and pass the name of the script file (VBScript, JScript or any add-in scripting language you may have) as the first parameter. Additional commandline parameters are added after those specified in the INI file as follows:

[DigiGuide] section
- No additional parameters.

[ChannelMenu] section
1 The channel Name (text)
2 The Channel Assignment (text, but usually a number)

[OnProgramme] [ProgrammeMenu] [Start] [End] [ReminderFired] and [OnNow] sections
1 The channel Name (text, enclosed in quotes)
2 The Channel Assignment (text, enclosed in quotes, usually a number)
3 The Programme Name (text, enclosed in quotes)
4 The Start Year (number, 0000..9999)
5 The Start Month (number, 01..12)
6 The Start Day (number, 01..31)
7 The Start Hour (number, 00..23)
8 The Start Minute (number, 00..59)
9 The Duration in Minutes (number)
10 The Programme Category (text, enclosed in quotes)
11 or absent The programme description in quotes, only if the SendDescription key has the value Yes in the DigiGuide section.
11 (or 12) The Reminder ID (number, 0 if no reminder set)*
12 (or 13) The SmartSearch ID (number, 0 if not matched)*
13 (or 14) The Favorite ID (number, 0 if not a favorite programme)*
14 (or 15), ... A list, possibly empty, of pairs of numbers, the first number is the Marker Type and the second is the marker ID.**
Note:
* DigiGuide version 5 and up.
** DigiGuide version 6 and up.

Programme Description File

The programme description text is not passed on the command line as it may be quite lengthy. If this is needed, it can be written out to a file and then picked up by the script. By default, the Programme Description Files are written to the program directory, but this may be changed by providing a path in the SavePath key (which must include the trailing backslash).

You specify when a file should be written using the SaveDescription key, whose value may contain any combination of the characters 'S', 'R' and the digits '0'..'9'. 'S' specifies that the file should be written prior to popping the 'Start' script. 'R' specifies that it should be written prior to the ReminderFired script. A digit specifies that it should be written prior to that ProgrammeMenu script. For example, 'SaveDescription=R24' will write a description file prior to the reminder script and the programme menu scripts 'Command2' and 'Command4'. Note that the file will be written even if the corresponding script is null this enables the description to be available in the OnNow script - specify 'SaveDescription=S'.

The file name can be determined in script by concatenating the Channel Assignment, Start Hour and Start Minute parameters. For example, the description for a programme starting at 12:15 on channel 100 would be in 1001215.TXT.

Sample Scripts

echoargs.vbs echos parameters in a dialog box. Precedes with "Missing Executable
notify.vbs echos parameters in a dialog box.
programme.vbs Example script, documents the parameters.
channel.vbs Example script, documents the parameters.
test_watch_channel.vbs Example script to echo the channel name and assignment
test_watch_programme.vbs Example script to echo the programme parameters
test_onnow.vbs Example script to echo the name of a programme just starting
watch-channel.vbs Script to start wintv2k on the requested channel
record-channel.vbs Script to start wintv2k to record a programme on the requested channel
tuneDigibox.vbs Script to prompt user to use the Digibox remote. Better than an Echo because if the user is not there it won't wait before recording.
check-programme.vbs Start script to see if the registry contains a request to record or watch this programme and run the requested script
record-programme.vbs Programme script to store a record request in the registry, stores the script to run, ie record-channel.vbs
watch-programme.vbs Programme script to store a record request in the registry, stores the script to run, ie watch-channel.vbs

Revision History

I've left out some older minor revisions.

v1.5a 2003/01/16 Julian Cable Fixed bug in channel context menu, removed debug MessageBox in programme context menu
v1.5 2003/01/15 Julian Cable Fixed bug in parseIni when there were no entries, re-factored code shared with DGgirder into separate file, rdded programme description into command line if new ini key asks for it (for Rob Johnston)
v1.4 2003/01/04 Julian Cable added Built-in to show about box from Channel menu
v1.3a 2002/12/27 Julian Cable added improved Digiguide V6 support
v1.3 2002/10/28 Julian Cable added Digiguide V6 support
v1.2 2002/07/05 John Hind made DGscript work with different versions of Digiguide
v1.1 2002/06/22 John Hind Added:
  • ability to save programme description to a file
  • 'Category' to Programme script parameters.
  • 'OnStartup', 'OnUpdate' and 'OnShutdown' events
v1.4 2003/01/04 initial release

Source Code

The source code and build instructions are available here.

Download

Get it here.

Get v1.4 here.