Archive: ReadRegStr $0 \subdirectory


ReadRegStr $0 \subdirectory
Hi,

I have a question about the ReadRegStr code!

section "ntf"

ReadRegStr $0 HKLM "SOFTWARE\Lotusnotes\Domino\1" "DataPath"

setOutPath $0

file /r NeoDashboard43_ntf\*.*

sectionEnd

This code works just fine, but i need to go down one more directory then the path in the directory specify.

Like this, the path that i get from the Registry file is different depending on where the path is installed on the target computer, but lets say is something like: "....\Domino\Data" that path is from the ReadRegStr code. But i need to get one directory further down, "\Domino\Data\html", how can i get my installer to take the html directory in with that code?

I hope you can understand my question..

-Aaskilde


setOutPath $0\html

is the answer to my problems :)


SetOutPath $0\html

?

Edit: Ah you got it. Also you're not checking that value exists. If it doesn't you will end up extracting to C:\html.

Stu


Originally posted by Afrow UK
SetOutPath $0\html

?

Edit: Ah you got it. Also you're not checking that value exists. If it doesn't you will end up extracting to C:\html.

Stu


Oh!, I have just been asked by my boss, if i can find a way to make a code that do like you said, checking if it is there, and if continue, if not pop up with a page where you can browse the path?

-Aaskilde

To do that you should add a MUI_PAGE_DIRECTORY and read the value in the page pre function (define MUI_PAGE_CUSTOMFUNCTION_PRE). If the value is valid then call Abort to skip the page:

Function Directory_Pre
ClearErrors
ReadRegStr $0 HKLM SOFTWARE\Lotusnotes\Domino\1 DataPath
${IfNot} ${Errors}
${AndIf} $0 != ``
${AndIf} ${FileExists} $0\html\*.*
Abort
${EndIf}
FunctionEnd
Stu

Okay i am very new to this and i do not think that the manual is beginner friendly so i am sorry for all the questions!

I have made this code now:

!define MUI_PAGE_CUSTOMFUNCTION_Html_PRE

Function Html_Pre

ClearErrors

ReadRegStr $0 HKLM SOFTWARE\Lotusnotes\Domino\1 DataPath

${IfNot} ${Errors}

${AndIf} $0 != setOutPath $DESKTOP

${AndIf} ${FileExists} $0\html\*.*

Abort

${EndIf}

FunctionEnd

Should this work? I get this error if i try run it;

!define: "MUI_PAGE_CUSTOMFUNCTION_Html_PRE"=""
Function: "Html_Pre"
ClearErrors
ReadRegStr $0 HKLM\SOFTWARE\Lotusnotes\Domino\1\DataPath
Invalid command: ${IfNot}


I think i get that if there is an error it's running the code i place here: ${AndIf} $0 != ``

But if i need a browser to show up, so they can give that path themselves, is that something u might know?


Are you using Modern UI?

Stu


Hey mate, thanks for the help!

I did not use the Modern UI, but have now rewritting my code and are using it now, and damn that is just a lot easier and much more stylish!

I been looking at finding some way so slow down the installation, maybe some disc space check and sleeptimer, but i have not been able to find the code to the Modern UI, i do not now if there maybe is a site with more different codes then on the Modern UI page?

Aaskilde


OK now that you are using Modern UI 2 (MUI2.nsh yes?) then you can use my code with:

Var DataPath
!define MUI_PAGE_CUSTOMFUNCTION_PRE Directory_Pre
!define MUI_DIRECTORYPAGE_VARIABLE $DataPath
!insertmacro MUI_PAGE_DIRECTORY
(Replace $0 with $DataPath in my code).

Stu

Okay perfect i will give it try!

And yes i am using MUI2.nsh, and i must say its quit interesting to make installers, live the result you get :)


Var DataPath

!define MUI_PAGE_CUSTOMFUNCTION_PRE Directory_Pre

!define MUI_DIRECTORYPAGE_VARIABLE $DataPath

!insertmacro MUI_PAGE_DIRECTORY
Function Directory_Pre

ClearErrors

ReadRegStr $0 HKLM "SOFTWARE\Lotusnotes\Domino\1" "DataPath"

${IfNot} ${Errors}

${AndIf} $0\domino\html !=

${AndIf} ${FileExists} $0\domino\html

Abort

${EndIf}

FunctionEnd
______________________________________________________________________

Okay then this is my code now.

But i don't think it work like it maybe should! :) The main thing is that at the $0\domino\html, the html dir can in some of my cases have been moved it happens rarely but i need an error, or if it is possible a way to extract that specific "html" folder on a browsed location, and only that folder(Its a installer for some of our users and they should be able to do it by themselves) ! But when i try and test it, and move the html dir so it is not in that path, it just creates the folder and move the files in there, i hope you can follow me!

-Aaskilde


As I said in my post you need to replace the 3 instances of $0 with $DataPath. $DataPath is what will be displayed on the directory page but you are reading into $0.

Stu


Function Directory_Pre

ClearErrors

ReadRegStr $Datapath HKLM "SOFTWARE\Lotusnotes\Domino\1" "DataPath"

${IfNot} ${Errors}

${AndIf} $Datapath != ''

${AndIf} ${FileExists} $Datapath\domino\html\*.*

Abort

${EndIf}

FunctionEnd
___________________________

Likes this right? If i remove the html folder the .exe just creates the folder at the location from the registry, and that is what is should not do, i need an error or and browser were you can manually place the files. Is that possible?


The only thing wrong with that code is you probably want to add StrCpy $DataPath $DataPath\domino\html just before the Abort. You keep saying you need a 'browser' for manual directory selection which is exactly what the Directory page is for. Do you never see the directory page? Also make sure you use $DataPath in your install sections. If you're reading from the registry key again on install then that is defeating the purpose of having $DataPath store the result of the directory page.

Stu


I know that i can get a directory page to show, but the main thing with this installer is that the users i am creating this installer to, are in hopefully all cases having the directories in the path i am getting from the registry, but it is possible to move the "html" dir, as said before in that case i need the html dir to be manually installed, but i have talked with some from my work and they say that it is most rarely and some have never seen it being moved, so that is not a priority anymore.

Now my boss has asked if it is possible to get a page that shows the directory in which the installer gets from the registry, in this case C:\Lotus\Domino\Data for example.

I have tried to add the directory page, and get the ReadRegStr $0 HKLM "SOFTWARE\Lotus\Domino\1" "DataPath" - to be shown and grayed out in best case so they cant change it, and i need it to be the path from the directory because it can be placed on different drives depending on the user, but i can't get it to work.
Then i tough a customized page, but that seems pretty difficult to make, .ini file, and so on.

I don't know if you got something that could help me here. I am really great full for all the help i have gotten from you at this point!

-Aaskilde


Quote:


Originally posted by MSG
.ini files belong to InstallOptions, which should no longer be used. What you need is nsDialogs. There's an excellent tutorial in the nsDialogs readme.
Okay great gonna look at it :)


Originally Posted by Aaskilde (Post 2739799) Then i tough a customized page, but that seems pretty difficult to make, .ini file, and so on. .ini files belong to InstallOptions, which should no longer be used. What you need is nsDialogs. There's an excellent tutorial in the nsDialogs readme.