Winamp & Shoutcast Forums

Winamp & Shoutcast Forums (http://forums.winamp.com/index.php)
-   NSIS Discussion (http://forums.winamp.com/forumdisplay.php?f=65)
-   -   Language Problem Again (http://forums.winamp.com/showthread.php?t=262552)

Boyito 27th December 2006 17:10

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 18:23

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 18:35

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 18:59

code:
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 19:13

Because I dont Know How
When I put the code in .onGuiInit , compiler show an error

Red Wine 27th December 2006 19:22

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 19:36

OK RW
Thanks again

Red Wine 27th December 2006 19:45

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:
code:
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 16:17

Thanks for the explantion and thanks again for your time
Bye


All times are GMT. The time now is 04:35.

Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.