INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Windows Hotkeys in Theater View not working  (Read 1376 times)

Pistensau

  • Recent member
  • *
  • Posts: 32
Windows Hotkeys in Theater View not working
« on: January 07, 2019, 02:29:45 pm »

Hello,

I am using a Harmony remote to control my MC. In Windows 10 I mapped the power button of the remote to send a "Ctrl"+"F4" key stroke. Formerly I created a custom ressources.xml to send the system to hibernate when I power off all my equipment (hibernate because it resumes faster and where I left).
Now I need to send some special signals via UDP to my lighting equipment (self made ambilight) to switch to different modes when sending the system to hibernate. I do this with a batch script that sends the protocols and ends with the shutdown /h command. I trigger this script with a regular shortcut on the desktop to the batch file that is activated by the native Windows function to set a custom hot key that starts this shortcut to the script in background (minimized). I attached a screenshot of which Windows hotkey function I mean.
This hotkey is working even when other programs have focus. It also works when JRiver is running in front, but the Windows hotkey is not active anymore when I use Theater View (which I use in JRiver all the time...). Is there a setting in the options that prevent the Windows hotkey function to work in Theater View? What can I do to enable it?
Logged

RoderickGI

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8186
Re: Windows Hotkeys in Theater View not working
« Reply #1 on: January 07, 2019, 04:19:40 pm »

I would think that if you removed the Shift+F4 keyboard shortcut from the MC24 resource.xml file, then the Windows 10 shortcut key combination would work even when MC is running, in Theatre View, and in the foreground. Have you removed that shortcut from the correct file?

I say correct file because it should be the custom file you created in "C:\Program Files\J River\Media Center 24\Data\Custom Resources\" rather than the default file in "C:\Program Files\J River\Media Center 23\Data\Default Resources\", unless you just edited the default file. You should probably check both.

If that still doesn't work, you could try setting up a Global shortcut in the custom resource.xml file to duplicate the Windows 10 setup, so that the key combination worked whether MC was capturing these keystrokes or not. The only potential issue would be if both Windows and MC captured the key combination and both tried to execute the batch file. The resource.xml line would be something like;

<Entry Key="Shift;F4" Program="C:\Program File (x86)\Dreamscreen\Dreamscreen_Ambient_Modus.bat" Global="1" />

Put that in the <!-- Global shortcuts --> section at the top of the <ACCELERATORS> listing, as order counts. The first instance of a key combination is the one used, I believe, when there is more than one instance.

Note that the order of lines in the resource.xml file is important. The last occurrence of a key combination is the one used. This fact is used to add Mac specific shortcuts to MC, which are at the bottom of the resource.xml file and so override earlier lines defining the same key combination.
Logged
What specific version of MC you are running:MC27.0.27 @ Oct 27, 2020 and updating regularly Jim!                        MC Release Notes: https://wiki.jriver.com/index.php/Release_Notes
What OS(s) and Version you are running:     Windows 10 Pro 64bit Version 2004 (OS Build 19041.572).
The JRMark score of the PC with an issue:    JRMark (version 26.0.52 64 bit): 3419
Important relevant info about your environment:     
  Using the HTPC as a MC Server & a Workstation as a MC Client plus some DLNA clients.
  Running JRiver for Android, JRemote2, Gizmo, & MO 4Media on a Sony Xperia XZ Premium Android 9.
  Playing video out to a Sony 65" TV connected via HDMI, playing digital audio out via motherboard sound card, PCIe TV tuner

Pistensau

  • Recent member
  • *
  • Posts: 32
Re: Windows Hotkeys in Theater View not working
« Reply #2 on: January 08, 2019, 03:11:05 am »

Hi RoderickGI,
Thanks for your feedback. I corrected a mistake in my initial post, the key stroke is "Ctrl"+"F4".
Yes I'm using a custom resource.xml in "Custom Rescources" and I have removed the entry out of the file when trying to use the Windows hotkey function. Also veryfied before that the custom key stroke is not active anymore in JRiver. Windows hotkey is not working in Theater View. Even deleted the whole custom resource file just to be sure.

Interesting fact I noticed when playing around is when I reactivate the former entry in the resource.xml and the Windows hotkey in the shortcut on the desktop is active the same time, both commands seem to block each other in Theater View so that no action is performed with the key combination. Only when I delete the shortcut from the desktop that is set up with the Windows hotkey, the hotkey from the custom resource file becomes active again. So there seems so be some interaction between the Windows function and the JRiver hotkey function.

I tried your suggestion to use an entry like:
<Entry Key="Ctrl;F4" Program="C:\Program Files (x86)\Dreamscreen\Dreamscreen_Ambient_Modus.bat" Global="1" />
but it didn't perform any action.
I thought inside the resource.xml commands only work in combination with a Media Center Core Command (I originally used "27001" to perform shutdown to hibernate:
<Entry Key="Ctrl;F4" Command="27001" Param="2" Global="1" /> which worked well, but now I need to send the protocols in advance somehow).

I also tried the Core Command "20000" for "MCC_OPEN_FILE":
<Entry Key="Ctrl;F4" Command="20000" Param="C:\Program Files (x86)\Dreamscreen\Dreamscreen_Ambient_Modus.bat" Global="1" />
This opens at least the "Open file" window of the explorer out of MC but I am failing to point to the location of the batch file. I tried instead of "Param=" also "Program="; "Path="; "File="
 but still only the open file window in a default directory.

Any suggestions on tuning this approach?

Or alternative back to the initial question on why the Windows hotkey function is blocked only in Theater View (not in Standard View) and is there a way to make that work?




Logged

RoderickGI

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8186
Re: Windows Hotkeys in Theater View not working
« Reply #3 on: January 08, 2019, 05:44:53 pm »

First, sorry, I got that MC Global shortcut wrong in my last post. It should have been;

<Entry Key="Shift;F4" Type="Program" Command="C:\Program File (x86)\Dreamscreen\Dreamscreen_Ambient_Modus.bat" Global="1" />

I did some testing and this shortcut works as long as MC is running, whether it is in Standard View, Theatre View, the in-focus application or not.

But I figured that you would want this shortcut to work even if MC wasn't running. So I added a Windows shortcut for the same key combination, and the shortcut then worked when MC was not running. It also worked when MC was in Standard View and in-focus or not, or in Theatre View but not in-focus, but it didn't work if Theatre View was in focus.

So I changed the MC Shortcut so that it was no longer Global, expecting that when MC was in-focus the MC shortcut would always be used, so Theatre View would work, and otherwise the Windows shortcut would be used. Same problem, nothing happened in Theatre View.

So I added a Translate Flag so that the MC shortcut would only be active in Fullscreen, expecting that to mean Theatre View. (Note that I was actually testing using the Ctrl+Shift+F4 key combination, and a program called Notepad++.)
<Entry Key="Ctrl;Shift;F4" Type="Program" Command="C:\Program Files (x86)\Notepad++\notepad++.exe" TranslateFlags="8" />
That still didn't work in Theatre View.  In fact, it didn't even work when I deleted the Windows shortcut. Maybe fullscreen doesn't actually include Theatre View.


So my conclusion is that having a Windows shortcut defined using the same key combination as a shortcut in MC using resource.xml just will not work with Theatre View in-focus. If MC is always going to be running when you want to use this shortcut, then the above setting will work.




However, I see a potential problem in that solution;
I corrected a mistake in my initial post, the key stroke is "Ctrl"+"F4".

Ctrl+F4 is a standard Windows General shortcut key combination. It means "Close the active document", which for example in Chrome will close the current tab. See https://support.microsoft.com/en-us/help/12445

I thought you did well when you had picked Shift+F4 as the combination because it isn't assigned as a Windows Shortcut as far as I can tell. Plus it is a nice simple shortcut. It is used in quite a lot of applications though, as application specific shortcuts: https://defkey.com/what-means/shift-f4  I assume that when you defined the Ctrl+F4 shortcut you were overriding the standard Windows default.

If you use Ctrl+F4, that will override the Windows shortcut. For example, with MC running and the MC Global Ctrl+F4 shortcut in place, Ctrl+F4 no longer closes the current tab in Chrome, but runs the defined program instead. So Ctrl+F4 would have two different actions in Chrome, depending on whether MC is running in the background.

I suggest that you don't use Ctrl+F4, or even Shift+F4. Use a MC Global shortcut of Ctrl+Shift+F4 instead, although even that key combination is used in some applications, so if you have one of those applications open and in focus it is likely to override your MC Global Shortcut. See https://defkey.com/search?irq=Ctrl+Shift+F4.


I think the below is your best solution, and only expect it to work when MC is running. Delete the Windows key combination you have assigned to the batch file shortcut.
<Entry Key="Ctrl;Shift;F4" Type="Program" Command="C:\Program File (x86)\Dreamscreen\Dreamscreen_Ambient_Modus.bat" Global="1" />




PS: The Core Command "20000" for "MCC_OPEN_FILE" doesn't take any parameters. Any supplied parameters are ignored, as per the Core Commands Wiki: https://wiki.jriver.com/index.php/Media_Center_Core_Commands
Logged
What specific version of MC you are running:MC27.0.27 @ Oct 27, 2020 and updating regularly Jim!                        MC Release Notes: https://wiki.jriver.com/index.php/Release_Notes
What OS(s) and Version you are running:     Windows 10 Pro 64bit Version 2004 (OS Build 19041.572).
The JRMark score of the PC with an issue:    JRMark (version 26.0.52 64 bit): 3419
Important relevant info about your environment:     
  Using the HTPC as a MC Server & a Workstation as a MC Client plus some DLNA clients.
  Running JRiver for Android, JRemote2, Gizmo, & MO 4Media on a Sony Xperia XZ Premium Android 9.
  Playing video out to a Sony 65" TV connected via HDMI, playing digital audio out via motherboard sound card, PCIe TV tuner

Pistensau

  • Recent member
  • *
  • Posts: 32
Re: Windows Hotkeys in Theater View not working
« Reply #4 on: January 09, 2019, 05:10:57 am »

Thanks again for that comprehensive advise!

Your red marked suggestion is working for me and more than OK for the kind of useage of my HTPC (100% Theater View controlled by the remote). So it is OK for me that activating the script with the same key combination is not available outside of MC. In fact triggering it through the shortcut with a Windows hotkey was only an attempt of a work around.
I tweaked it a littlebit because calling the script lead to the Windows command Window popping up which didn't look nice and could cause problems with focus of Theater View and my remote mappings. So I'm now pointing to a shortcut to the batch file which I configured to open the batch file minimized. This is working fine. It is invisible performing the actions in background.

To my former attempt, I noticed in the table of the available MC Core Commands that Parameters of "20000" are ignored and was aware that this would highly be the problem why I cannot point to a specific location or file. I was looking for the final hint you gave me with the "Type="Program" Command=" which I haven't found documented anywhere.
This now gives me a lot more ability to control things out of MC.

In my choice of key combination I only checked which combinations are not used within MC (https://wiki.jriver.com/index.php/Keyboard_Hot-keys).
But I will follow your advise to look for a combination that is not - or less - in conflict with others, mainly the Windows hotkeys. I am pretty flexible in assigning different combinations to the remote button.

Thanks again for your great help!
Logged
Pages: [1]   Go Up