Archive: InstallDirRegKey


InstallDirRegKey
  Hey Guys,
i got a problem with InstallDirRegKey i need to check up 2 installdirregkeys for Teamspeak 3 Style package ...

InstallDirRegKey HKCU "Software\TeamSpeak 3 Client" ""
InstallDirRegKey HKLM "Software\TeamSpeak 3 Client" ""

its everytime set the installdir to the last ... how i can check if first not exist take the second and if the last not exist take the first??

Help plz :(


There is only support for 1. To use more than one, you need to code it yourself in .onInit


Originally posted by Anders
There is only support for 1. To use more than one, you need to code it yourself in .onInit

can you show me how? its needed ....

thx

*bump*


Quote:


Im sry though ur gone away and other guys think that this is solved.


But keep your project private if you include TeamSpeak files because the TeamSpeak Systems GmbH doesn't allow repackaging and republishing w/o permission. And as far as i understood, they won't give permission.
it's the reason why there are no legal portable versions of TeamSpeak. The versions made with THinstall are illegal.


Its a Skin, not illegal :) its official but i want to automatic it and i need to find out how i can check 2 regestrys from the regedit if they exist or not ... can anyone PLZ help me?!


Something like this...
( checks HKCU first, falls back to HKLM, then falls back to a default path )


"LogicLib.nsh"


>OutFile "test.exe"

>Function .onInit
; Clear all errors first
ClearErrors

; Check for the HKCU registry key (presuming paramter 'InstallLocation' by the installer.
ReadRegStr $0 HKCU "Software\TeamSpeak 3 Client" "InstallLocation"
${Unless} ${Errors}
; Ifthat doesnt fail, set the $InstDir variable to its value
StrCpy $InstDir$0
${Else}
;Otherwise, try the HKLM registry key (clear errors flag first)
ClearErrors
ReadRegStr$0 HKLM "Software\TeamSpeak 3 Client" "InstallLocation"
${Unless} ${Errors}
; This should look familiar
StrCpy $InstDir$0
${Else}
; Ifthis also failed (so HKCU -and- HKLM failed), set a default location.
StrCpy $InstDir "$PROGRAMFILES\Default\Installation\Folder\"
${EndIf}
${EndIf}
MessageBox MB_OK "
$$InstDir = $InstDir"
FunctionEnd

Section
SectionEnd
>

I say thx to you :) im very drunken, dont hope that i write stupid things :) and i have 1 more question, i want to build a exe ... i post it now ... second plz

;--------------------------------
;Include Modern UI

!include "MUI2.nsh"

;--------------------------------
;General

;Name and file
Name "Xetu-Hosting Teamspeak 3 Style"
OutFile "XetuStyle1.0.exe"

;Get installation folder from registry if available
InstallDirRegKey HKCU "Software\TeamSpeak 3 Client" ""
;InstallDirRegKey HKLM "Software\TeamSpeak 3 Client" ""


;Request application privileges for Windows Vista
RequestExecutionLevel admin

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

XPStyle on
Function .onInit

SetOutPath "$TEMP"
File "C:\Users\SilencShadoW\Desktop\Desktop\Xetu-Hosting\Style\plugins\splash.bmp"
File "C:\Users\SilencShadoW\Desktop\Desktop\Xetu-Hosting\Style\plugins\splash.dll"


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

InitPluginsDir
File /oname=$TEMP\splash.bmp "C:\Users\SilencShadoW\Desktop\Desktop\Xetu-Hosting\Style\plugins\splash.bmp"

advsplash::show 1000 600 400 -1 $TEMP\splash

Pop $0 ; $0 has '1' if the user closed the splash screen early,
; '0' if everything closed normally, and '-1' if some error occurred.

Delete $TEMP\splash.bmp
Delete $TEMP\splash.dll
SetOutPath C:

FunctionEnd

;--------------------------------
;Variables

Var StartMenuFolder

;--------------------------------
;Interface Settings

!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "C:\Users\SilencShadoW\Desktop\Desktop\Xetu-Hosting\Style\Header\xetu.bmp"
!define MUI_ABORTWARNING

;--------------------------------
;Pages

!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "C:\Users\SilencShadoW\Desktop\Desktop\Xetu-Hosting\Style\Lizenz\License.txt"
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY

;Start Menu Folder Page Configuration
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU"
!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\Xetu-Hosting Teamspeak 3 Style"
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"

!insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder

!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH


!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH

;--------------------------------
;Languages

!insertmacro MUI_LANGUAGE "English"

;--------------------------------
;Installer Section


Section "Xetu-Hosting Icon Pack" IconPack

SetOutPath "$INSTDIR"

SetOutPath $INSTDIR\gfx\Xetu
File "C:\Users\SilencShadoW\Desktop\Desktop\Xetu-Hosting\Style\gfx\Xetu\*"

!insertmacro MUI_STARTMENU_WRITE_BEGIN Application

!insertmacro MUI_STARTMENU_WRITE_END

SectionEnd


;___________________________________________________________________

Section "Xetu-Hosting Emoticons" Emoticons

SetOutPath "$INSTDIR"


SetOutPath $INSTDIR\gfx\Xetu\emoticons
File "C:\Users\SilencShadoW\Desktop\Desktop\Xetu-Hosting\Style\gfx\Xetu\emoticons\*"

!insertmacro MUI_STARTMENU_WRITE_BEGIN Application

!insertmacro MUI_STARTMENU_WRITE_END

SectionEnd


;___________________________________________________________________


Section "Xetu-Hosting Style" Style

SetOutPath "$INSTDIR"


SetOutPath $INSTDIR\styles
File "C:\Users\SilencShadoW\Desktop\Desktop\Xetu-Hosting\Style\styles\Xetu.qss"

;___________________________________________________________________

;Store installation folder
WriteRegStr HKCU "Software\Xetu-Hosting Teamspeak 3 Style" "" $INSTDIR

;Create uninstaller
WriteUninstaller "$INSTDIR\XetuUninstall.exe"

!insertmacro MUI_STARTMENU_WRITE_BEGIN Application

;Create shortcuts
CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk" "$INSTDIR\XetuUninstall.exe"

!insertmacro MUI_STARTMENU_WRITE_END


SectionEnd

;--------------------------------
;Descriptions

;Language strings
LangString DESC_IconPack ${LANG_ENGLISH} "The Xetu-Hosting Icon Pack."
LangString DESC_Emoticons ${LANG_ENGLISH} "The Xetu-Hosting Emoticons."
LangString DESC_Style ${LANG_ENGLISH} "The Xetu-Hosting Style."


;Assign language strings to sections
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${Style} $(DESC_Style)
!insertmacro MUI_DESCRIPTION_TEXT ${Emoticons} $(DESC_Emoticons)
!insertmacro MUI_DESCRIPTION_TEXT ${IconPack} $(DESC_IconPack)
!insertmacro MUI_FUNCTION_DESCRIPTION_END

;--------------------------------
;Uninstaller Section

Section "Uninstall"

Delete "$INSTDIR\gfx\Xetu\emoticons\*"
Delete "$INSTDIR\gfx\Xetu\*"
Delete "$INSTDIR\styles\Xetu.qss"

Delete "$INSTDIR\XetuUninstall.exe"

RMDir "$INSTDIR\gfx\Xetu\Emoticons"
RMDir "$INSTDIR\gfx\Xetu"

!insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder

Delete "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk"
RMDir "$SMPROGRAMS\$StartMenuFolder"

DeleteRegKey /ifempty HKLM "Software\Xetu-Hosting Teamspeak 3 Style"

SectionEnd
Is there a way that i build this installer only as patcher? that i start it and then its checks on a site if there is a newer version of the gfx, gfx/emoticons and styles/xetu.qss ??
and how i can solve it on the server if there is a way ... thank u!

And i have one more Question, how can i add on the finishpage some boxes to mark like view changelog and the needed one is ... a box to mark that the installer close teamspeak 3 and restart it ... is there a way for it?



Originally posted by silencshadow
*bump* Don't bump, you just posted this topic and it was #2 on the front page, bumping when you are really close to the top is just fucking rude. I was going to help you, but that is not going to happen now. You can wait (without bumping) to see if someone else gives you any help, or you can do it yourself, just take a look at the registry functions in the helpfile