How to assign a keyboard button to a function?
Well first, as Brian implied in reply #12 above, you can't just start assigning new functions to keyboard buttons that are already in use by MC, particularly buttons that are as commonly used as the left and right arrows. You need to either find how the button is currently used, and decide if you want to change the existing function, or you need to find buttons that are not used already. That includes buttons that are not used globally by Windows or other applications that are running. For example, you can't assign a new function to Alt-Tab without conflicting with the existing Windows function.
Note also that you can't just add keyboard button combinations at the end of the file, as it is possible to have multiple assignments for the one keyboard combination, and if you do that, the sequence they appear in the file affect which assignment is used. I'm not sure if the first or last assignment is used, as it isn't documented and I haven't tested it. But generally, you should avoid assigning multiple Commands to one Keyboard combination to avoid ambiguity.
The Resource.xml file in the "Custom Resources" directory is the right place to be making changes. This is how I would approach each requirement below:
a) Search the
Media Center Core Commands list and find the function you want to use for the requirement. Note that sometimes there is more than one MCC Command that can do the job, so get familiar with the Commands available.
b) Search the Resource.xml file for the MCC Command you have decided to use, to see if it is already defined in the file. There may be more than one instance, and each may use different parameters, so make sure you understand what each is doing. Read the text descriptions in the Resource.xml file, particularly the section on TranslateFlags. Brian has already suggested trying TranslateFlags of 17 and 21. You should understand what that means. 17=16+1 from the table, so the keyboard definition applies to "16: don't translate in IE, VB controls, or other unknown rich controls" and "1: don't translate in edits, comboboxes, and other data entry controls". 21=16+4+1. Every number can only be made up of a unique set of numbers that are to the power of 2. So under the heading "<!-- Playback engine shortcuts (shared) -->" you will see that the "Space" key has a TranslateFlags="401", which equals 256+128+16+1. You should be able to work out from the table what that means.
I find that Notepad++ is an excellent tool for doing searches like this. Much better than plain old Notepad. Notepad++ works much the same as Notepad, but has line numbers, can count all instances of a searched string, can open multiple files, colour codes the display based on the file contents (XML in this case) etc. All good stuff.
Now that you have confirmed that the Command you want to use either hasn't been assigned to a key combination yet, or you understand how it has been assigned and what it means.
c) Search the Resource.xml file for the key combination that you want to use. If you search for the "left" key, you will find that the word is mentioned 7 times, and there are
Key="" assignments that include the "Left" key, including
Key="Left",
Key="Ctrl;Left",
Key="Ctrl;Shift;Left", and
Key="Alt;Left", and they don't all have the same TranslateFlags so they apply at different times.
The primary assignment,
<Entry Key="Left" Command="28004" TranslateFlags="32" />, runs the "MCC_PLAYBACK_ENGINE_LEFT" Command, which I believe is the Command responsible for the "Jump back xx seconds" behaviour, where xx is defined under "Options>Audio>Stop, Seek & Skip>Jump Behavior" for audio, and "Options>Video>Advanced>Jump Behavior" for video. It would not be a good idea to assign a new Command to the "Left" key.
But the "Shift;Left" key combination does not have an assignment to it, so you could use that. The "Ctrl;Left" combination has been used though, so probably shouldn't be reassigned.
Some key combinations could be reassigned though. For example, your requirement 2) probably shouldn't use F11, but F7 has been assigned to the Command 30006 with the line
<Entry Key="F7" Command="30006" Param="0" />. That is the "MCC_TUNE_TV" Command, which probably doesn't need a shortcut key combination. So you could edit that assignment and change it to what you need. That is just an example though, not a recommendation. You have to decide which key combinations you want to retain, and which you may be willing to reassign.
d) Once you have the Command selected, including any parameters, and the key combination you want to use, you need to decide in which context it should work, and hence what TranslateFlags should be assigned to it. Use the table in the Resource.xml file to decide that, as described above. For example, your second requirement probably should have TranslateFlags of 1, 4, 16, 32, and 256, so the value in the Resource.xml file should be the sum of all those numbers, which is 309. Now, I'm not sure that is the correct number for your second requirement, but as you should probably only be setting a Window to 100% when playing video in a Detached Window, that is probably a good start. 309 allows the function in Theatre View, (128 is not included in the TranslateFlags) and doesn't limit it to Full Screen (8 is not included in the TranslateFlags), which may or may not be correct. You will have to experiment with the TranslateFlags to get the result you want.
Now, on to your actual requirements. Which Commands to use?
1) I'd like to press a key to assign a video preview. For example F10.
I'm not sure exactly what you want for this one. Play the video and you will see what it is. There isn't really a video Preview in MC, as far as I know. I'm sure you don't mean just a thumbnail, but an actual small version of the video playing somewhere. There is a MCC Command 10031 "MCC_SET_PREVIEW_MODE_SETTINGS", but I don't know how that works. It seems to just be setting the parameters for a preview, so I thought it might be for images only. You could try that.
But the closest thing to a Preview in MC that I could think of was to play the video in Standard View, so that it appears in the Action Window in the bottom left corner. Now that would require two Commands; Play and switch to Standard View. Bottom line on this one, Play the video, then press Ctrl-1 to switch to Standard View, if that meets your requirement.
2) I'd like to press a key to assign window video screen at 100%, not "fit window" (default). For example F11.
MCC Command 28028 "MCC_PLAYBACK_ENGINE_ZOOM_TO_PRESET" int 0 to fit window, 1 for 100%, 2 for 200%
So if you used "F7" as the keyboard shortcut, edit the existing line in the Resource.xml file to;
<Entry Key="F7" Command="28028" Param="1" TranslateFlags="309" />.
Of course if you meant you just want Full Screen like Internet Explorer does, as opposed to maximising the MC window, then Standard View in MC doesn't do that. However, pressing F11 (or Shift-F11) in Standard View jumps to Full Screen Theatre View, and Shift-F11 jumps back to Standard View with the window sized as it was previously.
Also, if you are using a media keyboard that has a touch pad on it, right clicking on a playing video allows you to select Window>Fit to window/100%/200%.
3) I'd like to press a key to assign "jump behaviour: forward 1seg. / backward 1seg.". For example right/left direction keys.
You found the correct Commands for this, if you want to jump forward and back in a video one second;
10034 MCC_SEEK_FORWARD int nMilliseconds (0 means default -- varies depending on playback type)
10035 MCC_SEEK_BACK int nMilliseconds (0 means default -- varies depending on playback type)So Brian's suggestion of;
<Entry Key="Shift;Right" Command="10034" Param="1000" TranslateFlags="17" />
<Entry Key="Shift;Left" Command="10035" Param="1000" TranslateFlags="17" />should work. The TranslateFlags may need to be just 21, or "32: targets playback engine / display (DVD, image playback, etc.)", or might need to be 1+4+16+32=53. Test these.
Note that MCC Commands 10034 and 10035 are already used, but with the Parameter "0", which means to jump forward and backward the default amount of time, usually 30 and 10 seconds respectively. See lines;
<Entry Key="Ctrl;Shift;Right" Command="10034" Param="0" TranslateFlags="17" />
<Entry Key="Ctrl;Shift;Left" Command="10035" Param="0" TranslateFlags="17" />These work in Standard View, Theatre View, and a Detached Window, while a the plain "Left" and "Right" keys only work in Theatre View, and a Detached Window.
Note that the plain "Left" and "Right" keys use the Commands;
28004 MCC_PLAYBACK_ENGINE_LEFT
28005 MCC_PLAYBACK_ENGINE_RIGHT and are including in the Resource.xml file as;
<Entry Key="Left" Command="28004" TranslateFlags="32" />
<Entry Key="Right" Command="28005" TranslateFlags="32" />Targeting just the Playback Engine with TranslateFlags of "32".
Of course if you meant to jump forward or backward one Chapter in a DVD or something, that would be a different MCC Command.
1) when I play a video: Window ==> "use screengrab for thumbnail"
Use MCC Command;
10055 MCC_VIDEO_SCREEN_GRAB 0: use as thumbnail; 1: save as external file 2) when I play a video: Window ==> "100%"
Is this the same as #2 above? Or is this supposed to be "Show 1920x1080 video at 1920x1080 pixels, instead of scaling the video"? Anyway, discussed above. Also note that Ctrl-4 takes you to Theatre View, which is always Full Screen.
Okay, that was probably more than you bargained for, and some of it may not be relevant. But at least that should give you more of an idea about using the Resource.xml file, without breaking other MC functionality.
Apologies Brian for jumping in on this, but I have had to work out some of the above, and haven't seen it written up anywhere. So now was a good time to have a go.