How to change button behaviour on remote

A place to talk about GPUs/Motherboards/CPUs/Cases/Remotes, etc.
Post Reply
fobos8

Posts: 42
Joined: Sun Mar 17, 2013 10:28 am
Location:

HTPC Specs: Show details

How to change button behaviour on remote

#1

Post by fobos8 » Tue Jan 06, 2015 10:48 am

Hi all and happy new year

I have a VRC-1100 remote, an Ortek I think. It works great for WMC but I'd like to use on of the buttons to start up an app on my PC.

Anyone got a clue on how to do this?

Regards, Andrew

User avatar
CyberSimian

Posts: 516
Joined: Mon Jun 20, 2011 5:52 pm
Location: Southampton, UK

HTPC Specs: Show details

#2

Post by CyberSimian » Tue Jan 06, 2015 12:07 pm

fobos8 wrote:I have a VRC-1100 remote, an Ortek I think. It works great for WMC but I'd like to use on of the buttons to start up an app on my PC.
Most WMC remote controls send RC6 infra-red signals, but there is a small number that do not -- and the Ortek is one of these. When you plug in the Ortek IR receiver, Windows thinks that you have plugged in a keyboard! So, you want a program that will start an application in response to a particular keystroke. Two programs that might work are AutoHotKey and EventGhost.

AutoHotKey intercepts keystrokes, and allows you to map specified keystrokes to something else, including (I think) starting another application. Obviously, each button on the Ortek corresponds to a specific keystroke, and you would need to determine what keystroke the Ortek is sending for the button that you want to use. According to my notes, the four coloured buttons, and the four buttons in the row below the coloured buttons, send these keystrokes:

yellow: CTRL_O
blue: CTRL_M
green: CTRL_I
red: CTRL_E
recorded tv: CTRL_O (same as yellow)
epg: CTRL_G
live tv: CTRL_T
dvd: CTRL_SHIFT_M

Having determined the keystroke for the button that you want to use, you would then set up an AutoHotKey script to cause that keystroke to start the application. See the AutoHotKey website for further details.

I have never used EventGhost, but imagine that it could be used; see the EventGhost website for further details.

-- from CyberSimian in the UK

fobos8

Posts: 42
Joined: Sun Mar 17, 2013 10:28 am
Location:

HTPC Specs: Show details

#3

Post by fobos8 » Tue Jan 06, 2015 12:17 pm

Thanks CyberSimian

I have looked at EventGhost but when you submit your remote to the control of EventGhost it takes over all the buttons and mouse and you have to remap everything. Does AutoHotKey behave in the same way?

Regards, Andrew

mdavej

Posts: 1477
Joined: Mon Aug 20, 2012 6:52 pm
Location:

HTPC Specs: Show details

#4

Post by mdavej » Tue Jan 06, 2015 12:26 pm

You can also simply make a shortcut that responds to the above without using any extra software.

fobos8

Posts: 42
Joined: Sun Mar 17, 2013 10:28 am
Location:

HTPC Specs: Show details

#5

Post by fobos8 » Tue Jan 06, 2015 1:19 pm

according to my wife the mouse on the remote is horrible to use and she just want to press a button!

mdavej

Posts: 1477
Joined: Mon Aug 20, 2012 6:52 pm
Location:

HTPC Specs: Show details

#6

Post by mdavej » Tue Jan 06, 2015 4:52 pm

Shortcuts will run from the keystrokes, no mouse required. Set it up in the shortcut properties.

User avatar
CyberSimian

Posts: 516
Joined: Mon Jun 20, 2011 5:52 pm
Location: Southampton, UK

HTPC Specs: Show details

#7

Post by CyberSimian » Tue Jan 06, 2015 8:04 pm

fobos8 wrote:I have looked at EventGhost but when you submit your remote to the control of EventGhost it takes over all the buttons and mouse and you have to remap everything. Does AutoHotKey behave in the same way?
No; with AutoHotKey you can remap just a single keystroke, if that is all you want to do.

Unfortunately, I am a beginner when it comes to using AutoHotKey, so I am not the best person to advise you. But there is a "Run" command in AutoHotKey, so the syntax for a one-line file called "start_app.ahk" might be something like the following; this attempts to remap the "Browser_Home" button on the Ortek remote control (top left button) to start an application called "name.exe" residing in folder "C:\path\":

browser_home::run "C:\path\name.exe" app_parameters_and_options_go_here

The problem is that I don't actually know whether this syntax is correct. If it does not work, you should ask on the AutoHotKey forum; they should be able to help you. Also, look at the AutoHotKey documentation for a description of the "Run" command, as it may have some examples of use.

To run your AutoHotKey script, type the following in a command window (or click on "start_app.ahk" in Windows Explorer):

"C:\program files\autohotkey\autohotkey.exe" "start_app.ahk"

-- from CyberSimian in the UK

User avatar
CyberSimian

Posts: 516
Joined: Mon Jun 20, 2011 5:52 pm
Location: Southampton, UK

HTPC Specs: Show details

#8

Post by CyberSimian » Tue Jan 06, 2015 8:10 pm

mdavej wrote:You can also simply make a shortcut that responds to the above without using any extra software.
I just had a look at the help for this, and on WinXP you can define keyboard shortcuts only for combinations that use CTRL_ALT, so that would not work for the Ortek. According to my notes, there isn't a single button on the Ortek that generates a CTRL_ALT combination.

Do Vista/Win7/Win8 allow combinations other than CTRL_ALT?

-- from CyberSimian in the UK

fobos8

Posts: 42
Joined: Sun Mar 17, 2013 10:28 am
Location:

HTPC Specs: Show details

#9

Post by fobos8 » Tue Jan 06, 2015 8:37 pm

many thanks for pointing me in the direction of Autohotkey. Have found some good tutorials and I'm can already open up iTunes with a specific key from my keypad. All I need to do now is sort it for my Ortek.

Thanks again, Andrew

crawfish

Posts: 465
Joined: Fri Jan 13, 2012 5:16 am
Location:

HTPC Specs: Show details

#10

Post by crawfish » Tue Jan 06, 2015 9:36 pm

fobos8 wrote:many thanks for pointing me in the direction of Autohotkey. Have found some good tutorials and I'm can already open up iTunes with a specific key from my keypad. All I need to do now is sort it for my Ortek.

Thanks again, Andrew
See my messages in this thread for some AHK examples:

http://www.thegreenbutton.tv/forums/vie ... f=7&t=7555

It's aimed at using a regular MCE remote, for which the PC receives IR codes and translates them into actions, but the AHK excerpt is still relevant. It's a partial implementation I posted to illustrate my general solution for WMC, XBMC, etc.

Significantly, my approach of mapping IR codes to F13-F24 key combinations lets me make the remote active only for those programs I want to operate with the remote, so there's no danger of accidentally sending a keypress like Ctrl+O to a random program that has the focus. If the Ortek behavior has been described accurately, it does the worse thing possible by appearing as just another keyboard and sending commonly used key combinations. If that's correct, there may be no way to distinguish remote button presses from keyboard keys, and you'll have to be very careful if, say, you sometimes use WMC in windowed mode while browsing the web or whatever. If you do that, you will end up sometimes pressing a remote button while some other program has the focus, and if Ortek sends Ctrl+O, Ctrl+G, etc, that program will act on those keypresses just like you typed them on a keyboard.

For your iTunes goal, you need to find a button on the Ortek that sends a keypress that no program on your system uses, so it doesn't matter which program has the focus when you press the button. Good luck with that if there is nothing like ReportMappingTable to enable you to remap buttons.

fobos8

Posts: 42
Joined: Sun Mar 17, 2013 10:28 am
Location:

HTPC Specs: Show details

#11

Post by fobos8 » Tue Jan 06, 2015 9:56 pm

this is all I needed to open up iTunes from the blue button on my Ortek VRC-1100 remote using AutoHotkeys

^m::Run iTunes

crawfish

Posts: 465
Joined: Fri Jan 13, 2012 5:16 am
Location:

HTPC Specs: Show details

#12

Post by crawfish » Tue Jan 06, 2015 10:01 pm

I forgot I had also posted my AHK "multimedia program" launch code, which defines a set of multimedia programs and closes any that are running before launching a new one. As explained in the code, after I began converting WM_APPCOMMAND keys to F13-F24 key combinations, I found that iTunes would not eat those keys, so I could leave it running in the background. However, it's still a good idea to have only one of WMC and XBMC running at the same time. Anyway, here's a link to that message:

http://www.thegreenbutton.tv/forums/vie ... 211#p32211

There have been some minor changes to what I posted in that I no longer special-case WMC due to a glitch introduced by iTunes 11. I'd edit the post, but it appears it has been locked, I guess because it is a couple of years old. I'll reply to it in that thread with the updates.

crawfish

Posts: 465
Joined: Fri Jan 13, 2012 5:16 am
Location:

HTPC Specs: Show details

#13

Post by crawfish » Tue Jan 06, 2015 10:05 pm

fobos8 wrote:this is all I needed to open up iTunes from the blue button on my Ortek VRC-1100 remote using AutoHotkeys

^m::Run iTunes
Realize that whichever program has the focus had better not use Ctrl+M for anything, because you're eating that key combination on a global basis.

mdavej

Posts: 1477
Joined: Mon Aug 20, 2012 6:52 pm
Location:

HTPC Specs: Show details

#14

Post by mdavej » Wed Jan 07, 2015 1:49 am

CyberSimian wrote:
mdavej wrote:You can also simply make a shortcut that responds to the above without using any extra software.
I just had a look at the help for this, and on WinXP you can define keyboard shortcuts only for combinations that use CTRL_ALT, so that would not work for the Ortek. According to my notes, there isn't a single button on the Ortek that generates a CTRL_ALT combination.

Do Vista/Win7/Win8 allow combinations other than CTRL_ALT?

-- from CyberSimian in the UK
I can also do these in Win7 (haven't tested Win8):

Code: Select all

Shift_Alt
Ctrl_Shift
Shift_F1-F12
F1-12
Num 0-9 (Num=numpad)
Num + - * / Del
Shift_Num + - * / Del
So at least Ctrl_Shift_M would work for Ortek. Do you have the complete list, besides the obvious num keys and arrow keys?

How did you see what keystroke was being sent? I'd like to do this with my Diamond Media remote, which isn't MCE either but seems to be more compatible than Ortek, meaning normal MCE Play button behavior, among other things.

fobos8

Posts: 42
Joined: Sun Mar 17, 2013 10:28 am
Location:

HTPC Specs: Show details

#15

Post by fobos8 » Wed Jan 07, 2015 7:43 am

mdavej
So at least Ctrl_Shift_M would work for Ortek
the ortek blue coloured button relates to Ctrl M. When I try to set up the short cut key in the shortcut properties by pressing "Ctrl" and "m" together the code CTRL + ALT + M gets entered in the properties. This doesn't work when I press Ctrl M or the blue button on the Ortek

To see what the keystrokes are - run an AutoHotKey file with #InstallKeybdHook in the code. Then open the .ahk file while the script is running by right clicking on the green "H" in the taskbar. Then click on View, the Key History and script info. All the keys you press are logged in there.

Regards, Andrew

User avatar
CyberSimian

Posts: 516
Joined: Mon Jun 20, 2011 5:52 pm
Location: Southampton, UK

HTPC Specs: Show details

#16

Post by CyberSimian » Wed Jan 07, 2015 3:52 pm

CyberSimian wrote:According to my notes, the four coloured buttons, and the four buttons in the row below the coloured buttons, send these keystrokes:
yellow: CTRL_O
blue: CTRL_M
green: CTRL_I
red: CTRL_E
recorded tv: CTRL_O (same as yellow)
epg: CTRL_G
live tv: CTRL_T
dvd: CTRL_SHIFT_M
Apologies, but the codes that I quoted previously are not quite right -- I must have made a copying error. :( The correct codes are:

yellow: CTRL_SHIFT_T
blue: CTRL_M
green: CTRL_I
red: CTRL_E
recorded tv: CTRL_O
epg: CTRL_G
live tv: CTRL_T
dvd: CTRL_SHIFT_M

-- from CyberSimian in the UK

User avatar
CyberSimian

Posts: 516
Joined: Mon Jun 20, 2011 5:52 pm
Location: Southampton, UK

HTPC Specs: Show details

#17

Post by CyberSimian » Wed Jan 07, 2015 4:32 pm

mdavej wrote:Do you have the complete list, besides the obvious num keys and arrow keys?
See file included at end.
mdavej wrote:How did you see what keystroke was being sent? I'd like to do this with my Diamond Media remote, which isn't MCE either but seems to be more compatible than Ortek, meaning normal MCE Play button behavior, among other things.
I happened to have a keyboard test program that I wrote for testing another application. The test program simply reads keystrokes and outputs them (in hexadecimal!) to the screen and a log file. Unfortunately, it does not understand key names, so having got the hex codes, one then has to consult elsewhere (e.g. Microsoft key-code tables) to convert the hex codes into key names.

The easiest solution is to follow fobos8's suggestion, and use the keystroke logging facility built into AutoHotKey. However, I would point out one potential trap. If you press the SKIP_FORWARD and SKIP_BACKWARD buttons on the Ortek, you will see in the AutoHotKey log file that they are displayed as the P and Q keys. But if you actually press the P and Q keys, you will see that they have different hexadecimal codes! :o In other words, the AutoHotKey log file does not display the correct key name for all keys; most will be correct, but a few will be incorrect. In AutoHotKey, the key names are actually MEDIA_NEXT and MEDIA_PREV for the SKIP_FORWARD and SKIP_BACKWARD buttons. So you need to look at the hex codes too.

Another thing that you may notice is the non-standard way in which the Ortek handles the shifts. If I want to press CTRL_F1, I use this sequence:

press and hold CTRL
press F1
release F1
release CTRL

But for (e.g.) the yellow button, the Ortek sends this sequence:

press and hold CTRL
press and hold SHIFT
press and hold T
release CTRL
release SHIFT
release T

So the keystrokes are incorrectly nested. Does this matter? Probably not, because the keys are typamatic, and therefore must operate on the press, and not on the release.

-- from CyberSimian in the UK

Here is my incomplete AutoHotKey file for using the Ortek remote control with MediaPortal. You should look at the column labelled "Ortek Button" to find the entry for the button that you want, and then look in the "WMC Shortcut" column to see what keyboard shortcut the Ortek is sending. You can ignore the other two columns.

Code: Select all

; Author:   CyberSimian3@BTinternet.com.
; Updated:  2015-01-07
;
; Note: this is work in progress; not all button-mappings are correct!
;
;******************************************************************************
; AutoHotKey script for using Ortek VRC-1100 remote control with MediaPortal
; --------------------------------------------------------------------------
; o  This remote control is sold under various brand names:
;      Adesso ARC-1100; Gmyle; Hama 00052451; Ortek VRC-1100; Sanoxy VRC-1100
; o  The script maps the Windows Media Center keyboard shortcuts to Media
;    Portal keyboard shortcuts.
; o  The buttons are listed in the order in which they occur on the Ortek
;    remote control:
;    - from top row to bottom row,
;    - from left to right within each row.
; o  Some buttons do not require mapping, as the WMC keyboard shortcuts work
;    in MP.
; o  The left and right mouse buttons, and mouse pad, are not included.
; o  This file has been developed for use with the "aMPed" skin. Other skins
;    may require minor tweaks in order to reproduce the behaviour obtained
;    when using an MCE remote control.
; o  AutoHotKey scripts use the following notation:
;      ! == ALT key
;      ^ == CTRL key
;      + == SHIFT key
;      # == WINDOWS key
;      ; == comment line
;******************************************************************************
  #IfWinActive, MediaPortal      ; limit mappings to MP windows
; ----------------  -------------  ---------------------  ---------------------
; WMC Shortcut      MP Shortcut    Ortek Button           MP Function
; ----------------  -------------  ---------------------  ---------------------
      browser_home::browser_home ; browser home         ;
             sleep::sleep        ; power toggle         ;
               ^+t::^+t          ; my tv (yellow)       ;
                ^m::^m           ; my music (blue)      ;
                ^i::^i           ; my pictures (green)  ;
                ^e::^e           ; my videos (red)      ;
                ^o::^o           ; recorded tv          ;
                ^g::^g           ; guide (epg)          ;
                ^t::^t           ; live tv              ;
               ^+m::d            ; dvd                  ;
               ^+b::f5           ; fast rewind  ("<<")  ;
               ^+f::f6           ; fast forward (">>")  ;
; omitted: same as pause/resume  ; play (">")           ;
        media_prev::f7           ; skip back ("|<<")    ;
        media_next::f8           ; skip forward (">>|") ;
        media_stop::b            ; stop                 ;
  media_play_pause::space        ; pause/resume         ; pause/resume (toggle)
                ^r::r            ; record               ;
         backspace::escape       ; return ("<-")        ;
           rbutton::y            ; info                 ; show OSD (toggle)
                up::up           ; up                   ;
              left::left         ; left                 ;
            return::enter        ; ok                   ;
             right::right        ; right                ;
              down::down         ; down                 ;
         volume_up::+            ; volume up            ;
              pgup::pgup         ; channel up           ;
       volume_mute::m            ; mute                 ; mute (toggle)
       volume_down::-            ; volume down          ;
          #!return::f9           ; start                ; show menu (toggle)
              pgdn::pgdn         ; channel down         ;
           numpad1::1            ; 1                    ;
           numpad2::2            ; 2                    ;
           numpad3::3            ; 3                    ;
           numpad4::4            ; 4                    ;
           numpad5::5            ; 5                    ;
           numpad6::6            ; 6                    ;
           numpad7::7            ; 7                    ;
           numpad8::8            ; 8                    ;
           numpad9::9            ; 9                    ;
        numpadmult::*            ; asterisk             ;
           numpad0::0            ; 0                    ;
                 #::#            ; hash                 ;
               !f4::!f4          ; close                ; exit application
            escape::escape       ; clear                ;
; omitted: same as ok            ; enter                ;
; ----------------  -------------  ---------------------  ---------------------
; WMC Shortcut      MP Shortcut    Ortek Button           MP Function

jmsnyc

Posts: 6
Joined: Thu Jan 12, 2012 1:38 am
Location:

HTPC Specs: Show details

#18

Post by jmsnyc » Mon May 22, 2017 8:26 pm

@CyberSymian

I realize this is an old post. Hope you are still active

Are the last two columns being ignored and only for documentation? I notice both columns are preceded with semi colons.

Also if I want to map keys for another program, I just have to figure out what the window name is and replace it where MediaPortal is here:
#IfWinActive, MediaPortal ; limit mappings to MP windows

Thanks

User avatar
CyberSimian

Posts: 516
Joined: Mon Jun 20, 2011 5:52 pm
Location: Southampton, UK

HTPC Specs: Show details

#19

Post by CyberSimian » Tue May 23, 2017 8:22 am

jmsnyc wrote:Are the last two columns being ignored and only for documentation? I notice both columns are preceded with semi colons.
Yes, the last two columns are comments, and can be ignored or omitted. AutoHotKey uses the semicolon to start a comment (which extends to the end of the line).
jmsnyc wrote:Also if I want to map keys for another program, I just have to figure out what the window name is and replace it where MediaPortal is here:
#IfWinActive, MediaPortal ; limit mappings to MP windows
Yes, that is correct too. There are several different match modes for Window titles. You specify which you want to use via the "SetWindowMatchMode" instruction, like this:

Code: Select all

; Window-title match mode (1=match start, 2=match substring, 3=match exactly)
  SetTitleMatchMode, 1
If your program is running full screen, change to windowed mode (usually ALT_ENTER), to see what the window title is. The "#IfWinActive" instruction limits the subsequent definitions to the program running AND having the focus. There are other conditions that you might want to use:

#IfWinNotExist (= program not running)
#IfWinNotActive (= program running but does not have the focus)

-- from CyberSimian in the UK

Post Reply