View Single Post
Old 24th November 2015, 16:30   #5
Junior Member
Join Date: Nov 2015
Posts: 23
Originally Posted by LoRd_MuldeR View Post
If possible somehow, try to detect the exact file name from the registry. Or based on some other available info.

If it's really not possible and you have to search for the file at runtime, use something like:
PHP Code:
FindFirst $$"$INSTDIR\*.foo"
StrCmp $"" done
"Found: $1"
FindNext $$1
Goto loop
FindClose $

It's possible but I'm unsure if the registry would be the same across all versions of the program.

So I'm trying to open it as soon as I find the file. I know how to read/write with NSIS, but the above code you posted I don't 100% understand. Is this piece of code solely to detect whether or not the file exists in the directory?

I want to be able to find the file, hold it in a variable (I've done up to this part), and then check the variable to see if it fits the regex pattern I stated in the thread and then open if it does match.

I just tried

PHP Code:
Strcmp $"(program)20*.lsp" found notFound 
where $0 holds the correct file name. I think the 2nd part where it compares $0 to a string is where it falls, it most likely takes the * literally instead of what I want it to do.
Bungkai is offline   Reply With Quote