Boyito
27th December 2006 18:10 UTC
Language Problem Again
Hi
I put this code in my installer
#--------------------------------
#Installer Functions
Function .onInit
!insertmacro MUI_LANGDLL_DISPLAY
System::Call 'kernel32::CreateMutexA(i 0, i 0, t "MiSoftwareSetup") i .r1 ?e'
Pop $R0
StrCmp $R0 0 +3
MessageBox MB_OK|MB_ICONEXCLAMATION ${AlreadyRunning}
Abort
FunctionEnd
#--------------------------------
#Language strings ENGLISH
LangString AlreadyRunning ${LANG_ENGLISH} "The installer is already running!"
LangString AlreadyRunning ${LANG_SPANISH} "El instalador ya se esta ejecutando!"
#--------------------------------
But when I run the installer twice and select Other Language, it doesnt work, always show me in English
Whats Happend?
Red Wine
27th December 2006 19:23 UTC
First it is $(AlreadyRunning) not ${AlreadyRunning}.
Second the message is at .onInit function that's why it shows only english. Either take it .onGuiInit function, or remove langstrings and add messages like this:
StrCmp $R0 0 +6
StrCmp $LANGUAGE ${LANG_ENGLISH} 0 +3
MessageBox MB_OK|MB_ICONEXCLAMATION 'The installer is already running!'
goto +2
MessageBox MB_OK|MB_ICONEXCLAMATION 'El instalador ya se esta ejecutando!'
Abort
Boyito
27th December 2006 19:35 UTC
thanks RW
And how if i need 3 languages selection?
Like this??
StrCmp $R0 0 +6
StrCmp $LANGUAGE ${LANG_ENGLISH} 0 +3
MessageBox MB_OK|MB_ICONEXCLAMATION 'The installer is already running!'
goto +4
StrCmp $LANGUAGE ${LANG_SPANISH} 0 +3
MessageBox MB_OK|MB_ICONEXCLAMATION 'El instalador ya se esta ejecutando!'
goto +2
MessageBox MB_OK|MB_ICONEXCLAMATION 'O instalador está funcionando já!'
Abort
Red Wine
27th December 2006 19:59 UTC
StrCmp $R0 0 end
StrCmp $LANGUAGE ${LANG_ENGLISH} 0 spanish
MessageBox MB_OK|MB_ICONEXCLAMATION 'The installer is already running!'
goto exit
spanish:
StrCmp $LANGUAGE ${LANG_SPANISH} 0 porto
MessageBox MB_OK|MB_ICONEXCLAMATION 'El instalador ya se esta ejecutando!'
goto exit
porto:
MessageBox MB_OK|MB_ICONEXCLAMATION 'O instalador está funcionando já!'
exit:
Abort
end:
I'm afraid you have a small prob with relative jumps, better use labels:-) Anyway why don't you simply add the code that you first made in .onGuiInit function?
Boyito
27th December 2006 20:13 UTC
Because I dont Know How
When I put the code in .onGuiInit , compiler show an error
Red Wine
27th December 2006 20:22 UTC
because you're using MUI so you need to define your custom function MUI_CUSTOMFUNCTION_GUIINIT
See the MUI manual http://nsis.sourceforge.net/Docs/Mod...UI/Readme.html
General Custom Functions
Boyito
27th December 2006 20:36 UTC
OK RW
Thanks again
Red Wine
27th December 2006 20:45 UTC
You're welcome!
Note that I made the above code with the specific structure to help you understand the difference between relative jumps and labels :-)
Actually this is enough:
StrCmp $R0 0 end
StrCmp $LANGUAGE ${LANG_ENGLISH} 0 +3
MessageBox MB_OK|MB_ICONEXCLAMATION 'The installer is already running!'
Abort
StrCmp $LANGUAGE ${LANG_SPANISH} 0 +3
MessageBox MB_OK|MB_ICONEXCLAMATION 'El instalador ya se esta ejecutando!'
Abort
MessageBox MB_OK|MB_ICONEXCLAMATION 'O instalador está funcionando já!'
Abort
end:
Boyito
28th December 2006 17:17 UTC
Thanks for the explantion and thanks again for your time
Bye