Archive: Search for files, any easier way?


Search for files, any easier way?
hi back again, before im going into 24 hours of reading in the forum, witch i have allready done :-), im having some difficulties implenting a search script, and not sure if you really have to make 2 pages of script to make this installer search for a file on any location on any drive letter possibel. so far i have this section i wanna work with:

Function .onInit
ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\GhostRecon.exe" "path"
StrCmp $R0 "" NotPresent Present

notpresent:
StrCpy $INSTDIR "$programfiles\Red Storm Entertainment\Ghost Recon\Mods\Navy SEALS_V2"
MessageBox MB_ICONQUESTION|MB_YESNO "Couldent Find The Location Of [..\Ghost Recon\Mods], Want This Installer To Search For The Right Location?" IDYES +2
goto done
goto search

search:

present:

strcpy $instdir "$R0\mods\Navy SEALS_V2"
goto done

so what i have read to make a search was to enter this:

ComponentText "Check the drives where you want the installer to scan for Ghost Recon Directory." "" "Select drives to scan:"

; One section to scan drive C
Section "Drive C:"
; put search root on stack, initialize stack counter
StrCpy $8 1
Push "C:"
; start searching
Call FindFiles
SectionEnd

; One section to scan drive D
Section "Drive D:"
; put search root on stack, initialize stack counter
StrCpy $8 1
Push "D:"
; start searching
Call FindFiles
SectionEnd

now here is my question, is it really meaning you have to make a section like above for every harddrive letter possible? since there is alot of harddrive letter possible since cc: dd: ee: is also possible :-).
and when i wanted to make an goto the search section where the script should search for a file i would get an error that ComponentText cannot be inside a function, ok i moved it out, but look like the function .oninit and all the thing in there must not be seperated by no function stuff, hehe can it be done? and plz dont mind cut it out for me :-), since the stuff in the archives are not any good for me, there is to little info there, i dont get the whole picture. Well i almost dont get any of this scripting anyway :-(


You can also create a loop that checks all drives. The System plug-in allows you to detect which drives exist (see examples).


Ty Joost sounds great :-) well found a exampel, and can see i still need 2 pages of scripting to search for a file on any harddrive hehe. i guess thats just to find out what drive letter there is on the system :-( , so i still would know how to use the loop, since i dident find anything usefull there, can u give a link to an exampel written so i can understand it hehe. ty in advance, so far you have been most helpfull


ok im totally lost how would i incorporate the search for drives and add that loop in the script so the user can select the drives to search in, and then nicely get that in the script where i have the function search. since i dont get any of that, when i tried to just put the script in the function .oninit before the rest in .oninit, i will get an error installer corrupted, invalid opcode, i dont know what an opcode is hehe.