Skip to content
⌘ NSIS Forum Archive

Could somebody see what is wrong with my script

36 posts

VegetaSan#

Could somebody see what is wrong with my script

Could you please look at my script
(At the bottom of the script)

I want that my installer automaticly sets the .ogm extension to open with Media Player Classic
VegetaSan#
Script Information >>>>>

location "mplayercXP.exe"
$PROGRAMFILES\a-S Codec Pack\mplayercXP.exe
VegetaSan#
>>This is the IMPORTANT Section of the script<<

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

Section

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

SectionEnd
;-----------------------------------------------

WHAT IS WRONG?******************************???
VegetaSan#
Lobo King did you see my script. Could you take a look at that please and look what is the error THANKS
VegetaSan#
Section
;----------------------------------------------------------
!define Index "Line${__LINE__}"
ReadRegStr $1 HKCR ".ogm" ""
StrCmp $1 "" "${Index}-NoBackup"
StrCmp $1 "mplayercXP.OGMFile" "${Index}-NoBackup"
WriteRegStr HKCR ".ogm" "backup_val" $1
"${Index}-NoBackup:"
WriteRegStr HKCR ".ogm" "" "mplayercXP.OGMFile"
ReadRegStr $0 HKCR "mplayercXP.OGMFile" ""
StrCmp $0 "" 0 "${Index}-Skip"
WriteRegStr HKCR "mplayercXP.OGMFile" "" "Media Player Classic .OGM File"
WriteRegStr HKCR "mplayercXP.OGMFile\shell" "" "open"
WriteRegStr HKCR "mplayercXP.OGMFile\DefaultIcon" "" "$SYSDIR\mplayercXP.exe,0"
"${Index}-Skip:"
WriteRegStr HKCR "mplayercXP.OGMFile\shell\open\command" "" \
'$SYSDIR\mplayercXP.exe "%1"'
WriteRegStr HKCR "mplayercXP.OGMFile\shell\edit" "" "Media Player Classic .OGM File"
WriteRegStr HKCR "mplayercXP.OGMFile\shell\edit\command" "" \
'$SYSDIR\mplayercXP.exe "%1"'
!undef Index

SectionEnd
;----------------------------------------------------------

Location File "$SYSDIR\mplayercXP.exe"

What is wrong ******************************************
Joost Verburg#
You don't have to shout every minute. And we also have a button to edit posts.

Try putting quotes around paths with spaces using $\"
VegetaSan#
Note: The Compiler doesn't give a error (I can run the installer)

but .ogm files will not open with Media Player Classic
Joost Verburg#
It this case, the folder names contain spaces so you should put quotes around the whole path, for example:

"$PROGRAMFILES\a-S Media Player Classic\mplayercXP.exe"
VegetaSan#
I am getting craZY I dont know why

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

Section

!define Index "Line${__LINE__}"
ReadRegStr $1 HKCR ".ogm" ""
StrCmp $1 "" "${Index}-NoBackup"
StrCmp $1 "mplayercXP.OGMFile" "${Index}-NoBackup"
WriteRegStr HKCR ".ogm" "backup_val" $1
"${Index}-NoBackup:"
WriteRegStr HKCR ".ogm" "" "mplayercXP.OGMFile"
ReadRegStr $0 HKCR "mplayercXP.OGMFile" ""
StrCmp $0 "" 0 "${Index}-Skip"
WriteRegStr HKCR "mplayercXP.OGMFile" "" "Media Player Classic .OGM File"
WriteRegStr HKCR "mplayercXP.OGMFile\shell" "" "open"
WriteRegStr HKCR "mplayercXP.OGMFile\DefaultIcon" "" "$PROGRAMFILES\a-S Media Player ClassicXP\mplayercXP.exe,0"
"${Index}-Skip:"
WriteRegStr HKCR "mplayercXP.OGMFile\shell\open\command" "" \
'$PROGRAMFILES\a-S Media Player ClassicXP\mplayercXP.exe "%1"'
WriteRegStr HKCR "mplayercXP.OGMFile\shell\edit" "" "Media Player Classic .OGM File"
WriteRegStr HKCR "mplayercXP.OGMFile\shell\edit\command" "" \
'$PROGRAMFILES\a-S Media Player ClassicXP\mplayercXP.exe "%1"'
!undef Index

SectionEnd

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

What is wrong ******??

The file is in "$PROGRAMFILES\a-S Media Player ClassicXP\mplayercXP.exe"

and it should set .ogm files to open with "mplayercXP.exe"
VegetaSan#
Got it allmost it gives a error insted of just skipping it

THIS IS THE ERROR
WriteRegStr expects 4 parameters, got 5.
Usage: WriteRegStr rootkey subkey entry_name new_value_string
root_key=(HKCR|HKLM|HKCU|HKU|HKCC|HKDD|HKPD)
Error in script "C:\Documents and Settings\GokuSan\Bureaublad\ML + Wind and .NSI" on line 834 -- aborting creation process

and this is line 834 :
"$PROGRAMFILES\a-S Media Player ClassicXP\mplayercXP.exe "%1"'

what is wrong ??

please write the whole code down
kichik#
You should quote the path inside the entire parameter:

WriteRegStr HKCR "mplayercXP.OGMFile\shell" "" "open" '"$PROGRAMFILES\a-S Media Player ClassicXP\mplayercXP.exe" "%1"'
VegetaSan#
Still doesnt work

ERROR :
WriteRegStr expects 4 parameters, got 9. Wind and .NSI" on line 834 -- aborting creation process

SCRIPT
Section


!define Index "Line${__LINE__}"
ReadRegStr $1 HKCR ".ogm" ""
StrCmp $1 "" "${Index}-NoBackup"
StrCmp $1 "mplayercXP.OGMFile" "${Index}-NoBackup"
WriteRegStr HKCR ".ogm" "backup_val" $1
"${Index}-NoBackup:"
WriteRegStr HKCR ".ogm" "" "mplayercXP.OGMFile"
ReadRegStr $0 HKCR "mplayercXP.OGMFile" ""
StrCmp $0 "" 0 "${Index}-Skip"
WriteRegStr HKCR "mplayercXP.OGMFile" "" "Media Player Classic .OGM File"
WriteRegStr HKCR "mplayercXP.OGMFile\shell" "" "open"
WriteRegStr HKCR "mplayercXP.OGMFile\DefaultIcon" "" "$PROGRAMFILES\a-S Media Player ClassicXP\mplayercXP.exe" ;,0"
"${Index}-Skip:"
WriteRegStr HKCR "mplayercXP.OGMFile\shell\open\command" "" \
WriteRegStr HKCR "mplayercXP.OGMFile\shell" "" "open" '"$PROGRAMFILES\a-S Media Player ClassicXP\mplayercXP.exe" "%1"'
WriteRegStr HKCR "mplayercXP.OGMFile\shell\edit" "" "Media Player Classic .OGM File"
WriteRegStr HKCR "mplayercXP.OGMFile\shell\edit\command" "" \
"$PROGRAMFILES\a-S Media Player ClassicXP\mplayercXP.exe ; "%1"'
!undef Index

SectionEnd

Line 834 :
WriteRegStr HKCR "mplayercXP.OGMFile\shell" "" "open" '"$PROGRAMFILES\a-S Media Player ClassicXP\mplayercXP.exe" "%1"'
kichik#
WriteRegStr HKCR "mplayercXP.OGMFile\shell" "open" '"$PROGRAMFILES\a-S Media Player ClassicXP\mplayercXP.exe" "%1"'
VegetaSan#
The code you gave me is better but not good enough

ERROR
WriteRegStr expects 4 parameters, got 8.
on line 834 -- aborting creation process

Line 834
WriteRegStr HKCR "mplayercXP.OGMFile\shell" "open" '"$PROGRAMFILES\a-S Media Player ClassicXP\mplayercXP.exe" "%1"'
VegetaSan#
Nope I dont know why :::

Section

!define Index "Line${__LINE__}"
ReadRegStr $1 HKCR ".ogm" ""
StrCmp $1 "" "${Index}-NoBackup"
StrCmp $1 "mplayercXP.OGMFile" "${Index}-NoBackup"
WriteRegStr HKCR ".ogm" "backup_val" $1
"${Index}-NoBackup:"
WriteRegStr HKCR ".ogm" "" "mplayercXP.OGMFile"
ReadRegStr $0 HKCR "mplayercXP.OGMFile" ""
StrCmp $0 "" 0 "${Index}-Skip"
WriteRegStr HKCR "mplayercXP.OGMFile" "" "Media Player Classic .OGM File"
WriteRegStr HKCR "mplayercXP.OGMFile\shell" "" "open"
WriteRegStr HKCR "mplayercXP.OGMFile\DefaultIcon" "" "$PROGRAMFILES\a-S Media Player ClassicXP\mplayercXP.exe" ;,0"
"${Index}-Skip:"
WriteRegStr HKCR "mplayercXP.OGMFile\shell\open\command" "" \
WriteRegStr HKCR "mplayercXP.OGMFile\shell" "open" '"$PROGRAMFILES\a-S Media Player ClassicXP\mplayercXP.exe" "%1"'
WriteRegStr HKCR "mplayercXP.OGMFile\shell\edit" "" "Media Player Classic .OGM File"
WriteRegStr HKCR "mplayercXP.OGMFile\shell\edit\command" "" \
"$PROGRAMFILES\a-S Media Player ClassicXP\mplayercXP.exe ; "%1"'
!undef Index

SectionEnd

Could you look at this maybe there is something wrong with the other lines
kichik#
You have a backslash on the line before. That means the next line will be appended to it. Remove the backslash.
VegetaSan#
ERROR ON LINE 833
;LINE 832
"${Index}-Skip:"
;LINE 833
WriteRegStr HKCR "mplayercXP.OGMFile\shell\open\command" ""

ERROR =
WriteRegStr expects 4 parameters, got 2.
on line 833 -- aborting creation process


ONoTHER ErroR , Man this never stops


WHOLE SCRIPT :

Section

!define Index "Line${__LINE__}"
ReadRegStr $1 HKCR ".ogm" ""
StrCmp $1 "" "${Index}-NoBackup"
StrCmp $1 "mplayercXP.OGMFile" "${Index}-NoBackup"
WriteRegStr HKCR ".ogm" "backup_val" $1
"${Index}-NoBackup:"
WriteRegStr HKCR ".ogm" "" "mplayercXP.OGMFile"
ReadRegStr $0 HKCR "mplayercXP.OGMFile" ""
StrCmp $0 "" 0 "${Index}-Skip"
WriteRegStr HKCR "mplayercXP.OGMFile" "" "Media Player Classic .OGM File"
WriteRegStr HKCR "mplayercXP.OGMFile\shell" "" "open"
WriteRegStr HKCR "mplayercXP.OGMFile\DefaultIcon" "" "$PROGRAMFILES\a-S Media Player ClassicXP\mplayercXP.exe" ; ,0"
"${Index}-Skip:"
WriteRegStr HKCR "mplayercXP.OGMFile\shell\open\command" ""
WriteRegStr HKCR "mplayercXP.OGMFile\shell" "open" '"$PROGRAMFILES\a-S Media Player ClassicXP\mplayercXP.exe" "%1"'
WriteRegStr HKCR "mplayercXP.OGMFile\shell\edit" "" "Media Player Classic .OGM File"
WriteRegStr HKCR "mplayercXP.OGMFile\shell\edit\command" "" \
"$PROGRAMFILES\a-S Media Player ClassicXP\mplayercXP.exe "%1"'
!undef Index

SectionEnd
kichik#
It would have never started had you only changed what's needed.

!define Index "Line${__LINE__}"
ReadRegStr $1 HKCR ".ogm" ""
StrCmp $1 "" "${Index}-NoBackup"
StrCmp $1 "mplayercXP.OGMFile" "${Index}-NoBackup"
WriteRegStr HKCR ".ogm" "backup_val" $1
"${Index}-NoBackup:"
WriteRegStr HKCR ".ogm" "" "mplayercXP.OGMFile"
ReadRegStr $0 HKCR "mplayercXP.OGMFile" ""
StrCmp $0 "" 0 "${Index}-Skip"
WriteRegStr HKCR "mplayercXP.OGMFile" "" "Media Player Classic .OGM File"
WriteRegStr HKCR "mplayercXP.OGMFile\shell" "" "open"
WriteRegStr HKCR "mplayercXP.OGMFile\DefaultIcon" "" "$PROGRAMFILES\a-S Media Player ClassicXP\mplayercXP.exe,0"
"${Index}-Skip:"
WriteRegStr HKCR "mplayercXP.OGMFile\shell\open\command" "" '"$PROGRAMFILES\a-S Media Player ClassicXP\mplayercXP.exe" "%1"'
!undef Index
VegetaSan#
If this is the script code then it isnt right. I can run the installer succsesfully. But when I open .ogm files then it will open with Windows Media Player insted of "mplayercXP.exe"

Section

!define Index "Line${__LINE__}"
ReadRegStr $1 HKCR ".ogm" ""
StrCmp $1 "" "${Index}-NoBackup"
StrCmp $1 "mplayercXP.OGMFile" "${Index}-NoBackup"
WriteRegStr HKCR ".ogm" "backup_val" $1
"${Index}-NoBackup:"
WriteRegStr HKCR ".ogm" "" "mplayercXP.OGMFile"
ReadRegStr $0 HKCR "mplayercXP.OGMFile" ""
StrCmp $0 "" 0 "${Index}-Skip"
WriteRegStr HKCR "mplayercXP.OGMFile" "" "Media Player Classic .OGM File"
WriteRegStr HKCR "mplayercXP.OGMFile\shell" "" "open"
WriteRegStr HKCR "mplayercXP.OGMFile\DefaultIcon" "" "$PROGRAMFILES\a-S Media Player ClassicXP\mplayercXP.exe,0"
"${Index}-Skip:"
WriteRegStr HKCR "mplayercXP.OGMFile\shell\open\command" "" '"$PROGRAMFILES\a-S Media Player ClassicXP\mplayercXP.exe" "%1"'
!undef Index

SectionEnd
kichik#
Have you tried rebootin? Have you made sure Windows Media Player didn't revert the change (open regedit.exe and look under HKCR\.ogm)?
VegetaSan#
It wont work (it doesnt give a error but it doenst work)

[size=1]Section

DeleteRegKey HKLM "Software\Classes\.ogm\*.*"
!define Index "Line${__LINE__}"
ReadRegStr $1 HKCR ".ogm" ""
StrCmp $1 "" "${Index}-NoBackup"
StrCmp $1 "mplayercXP.OGMFile" "${Index}-NoBackup"
WriteRegStr HKCR ".ogm" "backup_val" $1
"${Index}-NoBackup:"
WriteRegStr HKCR ".ogm" "" "mplayercXP.OGMFile"
ReadRegStr $0 HKCR "mplayercXP.OGMFile" ""
StrCmp $0 "" 0 "${Index}-Skip"
WriteRegStr HKCR "mplayercXP.OGMFile" "" "Media Player Classic .OGM File"
WriteRegStr HKCR "mplayercXP.OGMFile\shell" "" "open"
WriteRegStr HKCR "mplayercXP.OGMFile\DefaultIcon" "" "$PROGRAMFILES\a-S Media Player ClassicXP\mplayercXP.exe,0"
"${Index}-Skip:"
WriteRegStr HKCR "mplayercXP.OGMFile\shell\open\command" "" '"$PROGRAMFILES\a-S Media Player ClassicXP\mplayercXP.exe" "%1"'
!undef Index

SectionEnd

And is this right:
DeleteRegKey HKLM "Software\Classes\.ogm\*.*"
Joost Verburg#
Can you post the values of all relevent registry keys and describe the behavior or error messages when opening the media file?
VegetaSan#
I want that my installer sets .ogm files to open with
mplayercXP.exe insted of Windows Media Player How do I do that

I Have done this with this script.. I can Run the installer but when I open .ogm files then it still opens with Windows Media Player insted of mplayercXP.exe

Info :
FileName : "mplayercXP.exe"
Directory : "$PROGRAMFILES\a-S Media Player Classic"

Script
Section

!define Index "Line${__LINE__}"
ReadRegStr $1 HKCR ".ogm" ""
StrCmp $1 "" "${Index}-NoBackup"
StrCmp $1 "mplayercXP.OGMFile" "${Index}-NoBackup"
WriteRegStr HKCR ".ogm" "backup_val" $1
"${Index}-NoBackup:"
WriteRegStr HKCR ".ogm" "" "mplayercXP.OGMFile"
ReadRegStr $0 HKCR "mplayercXP.OGMFile" ""
StrCmp $0 "" 0 "${Index}-Skip"
WriteRegStr HKCR "mplayercXP.OGMFile" "" "Media Player Classic .OGM File"
WriteRegStr HKCR "mplayercXP.OGMFile\shell" "" "open"
WriteRegStr HKCR "mplayercXP.OGMFile\DefaultIcon" "" "$PROGRAMFILES\a-S Media Player ClassicXP\mplayercXP.exe,0"
"${Index}-Skip:"
WriteRegStr HKCR "mplayercXP.OGMFile\shell\open\command" "" '"$PROGRAMFILES\a-S Media Player ClassicXP\mplayercXP.exe" "%1"'
DeleteRegKey HKCU "SOFTWARE\Classes\.ogm"
!undef Index

SectionEnd