This script lets one control applications by BeholdTV TV-tuner's remote control. BeholdTV is a brand of company InfoNetwork on russian market. If you don't happen to have BeholdTV tuner you might still find the script useful as a script template to control applications using RC API.
In addition to these three files there're also files where RC buttons actions to control applications are specified (each application has its own file). These files are in AppControl folder. They need to be included in the end of RemoteControl.ahk.
As of 2006-05-24 the script contains settings for 6 applications: BeholdTV, Winamp, ICE Book Reader, RemoteExplorer, Media Player Classic, FastStone Image Viewer.
To add configuration for a new application you need to do the following.
First, add new group in the section Applications configuration in Configuration.ahk. For Media Player Classic:
; Media Player Classic
App%I% = MediaPlayerClassic
RCKApp%I% =
PathApp%I% = C:\Program Files\K-Lite Codec Pack\Media Player Classic\mplayerc.exe
WinTitleApp%I% = Media Player Classic ahk_class MediaPlayerClassicW
Here
Another item which can be present here is HKCloseApp, a hotkey to close the application. It is needed only if AutoHotkey can't close the application (with WM_CLOSE).
Second, file for this application must be created in AppControl folder. File must contain subroutine where actions to control the application are mapped to RC buttons. Here's contents of MediaPlayerClassic.ahk:
/* -----------------------------------------------------------------------------
Media Player Classic control.
*/
MediaPlayerClassic:
; Play/pause
if RCKey = RCK_Ok
{
Send, {Space}
return
}
; Stop
if RCKey = RCK_Mode
{
Send, .
return
}
; Jump forward (medium)
if RCKey = RCK_Right
{
Send, ^{Right}
return
}
; Jump back (medium)
if RCKey = RCK_Left
{
Send, ^{Left}
return
}
; Volume up
if RCKey = RCK_Up
{
Send, {Up}
return
}
; Volume down
if RCKey = RCK_Down
{
Send, {Down}
return
}
; Full screen
if RCKey = RCK_Function
{
Send, !{Enter}
return
}
; Next subtitle
if RCKey = RCK_Info
{
Send, s
return
}
return
Third, the application file must be included in the end of RemoteControl.ahk:
#Include MediaPlayerClassic.ahk
If an application has several windows, window group is used. The group identifier is specified in WinTitleApp after ahk_group. For example, for FastStone Image Viewer:
; FastStone Image Viewer
App%I% = FSViewer
RCKApp%I% =
PathApp%I% = C:\Program Files\FastStone Image Viewer\FSViewer.exe
WinTitleApp%I% = ahk_group WG_FSViewer
HKCloseApp%I% = {Esc}
Then the window group is created in the section Window groups configuration in Configuration.ahk:
; FastStone Image Viewer
GroupAdd, WG_FSViewer, FastStone Image Viewer ahk_class FastStoneImageViewerMainForm
GroupAdd, WG_FSViewer, ahk_class TFullScreenWindow
When using the script together with Remote Explorer buttons to start/activate application may be not assigned for some applications.
Take Media Player Classic as an example. You run some video file in Remote Explorer. If the file type is associated with MPC the latter opens and activates. You watch the file, control MPC. Then you close MPC, run the next file in RE and so on.