Archive: Get filename from FileRequest object


Get filename from FileRequest object
Hi,

I'm using an FileRequest (GUI Object) to request an file from the user. This file must be copied to the installation folder:


!insertmacro MUI_INSTALLOPTIONS_READ $File "screen1.ini" "Field 4" "State"
CopyFiles /SILENT $File $INSTDIR


Now I need to write the filename to an INI file. So I need to do something with $File, cut the filename from this string. I can't find anything about regular expresions.

This there an other way to do this?

Thanks for the help.

Hi slimclity :)

Well, unfortunately there is nothing to support regular expressions, AFAIK. But to get your filename from the path, you can use the string functions from StrFunc.nsh (Check the StrFunc.txt).

The one you want is: StrStrAdv

${StrStrAdv} $ResVar "c:\Program Files\Software\MyApp\blah.exe" "\" "<" ">" "0" "0"


$ResVar should contain "blah.exe" at this point..


I hope that helps ;) !

evilO/Olive

PS: welcome to the forum :D


Originally posted by evilO

The one you want is: StrStrAdv

${StrStrAdv} $ResVar "c:\Program Files\Software\MyApp\blah.exe" "\" "<" ">" "0" "0"

$ResVar should contain "blah.exe" at this point..
Great! That works. :up:

Thanks for the help!