Lone Shepherd
1st May 2008 19:48 UTC
Finding a specific folder
Okay. . .NSIS newbie here. Looks like a very cool and powerful scripting language but I'm having trouble deciphering how it all works.
I want my installer to:
- Search for a specific directory and return the first match (if any)
- Use that full path as the default in a "browse" dialog, which the user can change if not correct.
- When the user clicks 'next' it will write that full path to a file
I've only gotten as far as the 'search for the path' part. I'm trying to have ${GetDrives} return all "HDD+NET" drives, and then use locate to search each drive for a directory name, and then stop if it finds a match and return the full path.
Any help
greatly appreciated.
Lone Shepherd
1st May 2008 21:19 UTC
Okay, so I have locate working without GetDrives:
${locate::Open} "C:\" "/F=0 /D=1 /M=SomeDir" $0
${locate::Find} $0 $1 $2 $3 $4 $5 $6
MessageBox MB_OK 'SomeDirdir: $2'
Now how do I put up a "wait" type dialog while it searches? And how do I incorporate GetDrive in there?
AaronLS
2nd May 2008 03:48 UTC
I would just use DetailPrint to print "Please Wait" which will appear in the install log page or the status bar depending on your settings.
I speculate that there might be something that could be done with nsDialogs to show a dialog.
You could create a separate exe that just displays a dialog, but the difficult part to showing a dialog, is that you would have to first spawn the dialog asynchronously, so that your script would then continue and perform the locate, then once the locate statement completes, you would then need to "find" that dialog and kill it.
AaronLS
2nd May 2008 15:13 UTC
I found a solution for showing the dialog:
Banner::show /NOUNLOAD "Please wait while the directory is found"
;do your long running stuff here
Banner::destroy
See for more info:
http://nsis.sourceforge.net/Docs/Banner/Readme.txt