Archive: I want that the installer automaticly sets the .ogm and .mkv extensions..............


I want that the installer automaticly sets the .ogm and .mkv extensions..............
I want that the installer automaticly sets the .ogm and .mkv extensions to open with Media Player Classic

for example : I used play .ogm files with Windows Media Player and When I install my installer then .ogm files will be automaticly set to open with Media Player Classic

How do I do that ??????????????????


See the following archive page:

http://nsis.sourceforge.net/archive/...php?pageid=282


I don't get this (My English isn't the best)

"OptionsFile"
Is the general description of the file. Make sure NOT TO USE GENERIC DESCRIPTIONS or descriptions IN USE BY OTHER APPLICATIONS. Use a format like ApplicationName.FileType. If the application name is too generic add for example the company name.

Could you translate this is easier English Thanks :)


Easier English:

Replace with "ApplicationName.FileType" where ApplicationName is your application name (no spaces) and FileType is the file type (no spaces).


I Have set this code in my script .................

Section

!define Index "Line${__LINE__}"
ReadRegStr $1 HKCR ".ogm" ""
StrCmp $1 "" "${Index}-NoBackup"
StrCmp $1 "OptionsFile" "${Index}-NoBackup"
WriteRegStr HKCR ".ogm" "backup_val" $1
"${Index}-NoBackup:"
WriteRegStr HKCR ".ogm" "" "OptionsFile"
ReadRegStr $0 HKCR "$PROGRAMFILES\a-S Media Player ClassicXP\mplayercXP.exe" ""
StrCmp $0 "" 0 "${Index}-Skip"
WriteRegStr HKCR "$PROGRAMFILES\a-S Media Player ClassicXP\mplayercXP.exe" "" "Program Options File"
WriteRegStr HKCR "$PROGRAMFILES\a-S Media Player ClassicXP\mplayercXP.exe\shell" "" "open"
WriteRegStr HKCR "$PROGRAMFILES\a-S Media Player ClassicXP\mplayercXP.exe\DefaultIcon" "" "$INSTDIR\execute.exe,0"
"${Index}-Skip:"
WriteRegStr HKCR "$PROGRAMFILES\a-S Media Player ClassicXP\mplayercXP.exe\shell\open\command" "" \
'$INSTDIR\execute.exe "%1"'
WriteRegStr HKCR "$PROGRAMFILES\a-S Media Player ClassicXP\mplayercXP.exe\shell\edit" "" "Edit Options File"
WriteRegStr HKCR "$PROGRAMFILES\a-S Media Player ClassicXP\mplayercXP.exe\shell\edit\command" "" \
'$INSTDIR\execute.exe "%1"'
!undef Index
; Rest of script

SectionEnd

I can Run the installer with this code but it doesnt set
.ogm files to play with Media Player Classic.
Could somebody see what is wrong ?????


You shouldn't rpelace OptionsFile with the entire application path, just the name. Soemthing like "MediaPlayerClassicXP.OGMFile". You should also replace $INSTDIR\execute.exe with the program you want openned. And don't forget to replace "Program Options File" with a good description like "Media Player Classic XP OGM File".


And this. Is this right???


Section

!define Index "Line${__LINE__}"
ReadRegStr $1 HKCR ".ogm" ""
StrCmp $1 "" "${Index}-NoBackup"
StrCmp $1 "mplayerXP.OGMFile" "${Index}-NoBackup"
WriteRegStr HKCR ".ogm" "backup_val" $1
"${Index}-NoBackup:"
WriteRegStr HKCR ".opt" "" "mplayerXP.OGMFile"
ReadRegStr $0 HKCR "mplayerXP.OGMFile" ""
StrCmp $0 "" 0 "${Index}-Skip"
WriteRegStr HKCR "mplayerXP.OGMFile" "" "Media Player Classic XP OGM File"
WriteRegStr HKCR "mplayerXP.OGMFile\shell" "" "open"
WriteRegStr HKCR "mplayerXP.OGMFile\DefaultIcon" "" "$SYSDIR\mplayerc2003.exe,0"
"${Index}-Skip:"
WriteRegStr HKCR "mplayerXP.OGMFile\shell\open\command" "" \
'$SYSDIR\mplayerc2003.exe "%1"'
WriteRegStr HKCR "mplayerXP.OGMFile\shell\edit" "" "Media Player Classic XP OGM File"
WriteRegStr HKCR "mplayerXP.OGMFile\shell\edit\command" "" \
'$SYSDIR\mplayerc2003.exe "%1"'
!undef Index
; Rest of script

SectionEnd


Almost. You forgot to replace one .opt with .ogm, the most important one ;)

WriteRegStr HKCR ".opt" "" "mplayerXP.OGMFile"

I also think you don't need the following two lines:

WriteRegStr HKCR "mplayerXP.OGMFile\shell\edit" "" "Media Player Classic XP OGM File"
WriteRegStr HKCR "mplayerXP.OGMFile\shell\edit\command" "" \
'$SYSDIR\mplayerc2003.exe "%1"'

You only want .ogm files to open with your app on double click, not to add an edit option in the context menu.


Still doenst work ?????

;--------------------------------
Section

!define Index "Line${__LINE__}"
ReadRegStr $1 HKCR ".ogm" ""
StrCmp $1 "" "${Index}-NoBackup"
StrCmp $1 "mplayerXP.OGMFile" "${Index}-NoBackup"
WriteRegStr HKCR ".ogm" "backup_val" $1
"${Index}-NoBackup:"
WriteRegStr HKCR ".ogm" "" "mplayerXP.OGMFile"
ReadRegStr $0 HKCR "mplayerXP.OGMFile" ""
StrCmp $0 "" 0 "${Index}-Skip"
WriteRegStr HKCR "mplayerXP.OGMFile" "" "Media Player Classic XP OGM File"
WriteRegStr HKCR "mplayerXP.OGMFile\shell" "" "open"
WriteRegStr HKCR "mplayerXP.OGMFile\DefaultIcon" "" "$SYSDIR\mplayerc2003.exe,0"
"${Index}-Skip:"
WriteRegStr HKCR "mplayerXP.OGMFile\shell\open\command" "" \
'$SYSDIR\mplayerc2003.exe "%1"'
WriteRegStr HKCR "mplayerXP.OGMFile\shell\edit" "" "Media Player Classic XP OGM File"
WriteRegStr HKCR "mplayerXP.OGMFile\shell\edit\command" "" \
'$SYSDIR\mplayerc2003.exe "%1"'
!undef Index
; Rest of script


SectionEnd


;--------------------------------

Information :

Directory of the file
$PROGRAMFILES\a-S Media Player Classic\mplayerc.exe


If the file is in "$PROGRAMFILES\..." why did you point it at $SYSDIR? If changing that still doesn't work specify what exactly doesn't work. What you do, what happens and what you expect to happen.