Archive: stringContains function ?


stringContains function ?
I want to see if the $EXEDIR string contains the $INTERNET_CACHE string.

Is there some kind of 'string contains' function out there?

been a while since I last used NSIS, so I am a bit rusty
g


There's StrStr which is in the NSIS documentation under Useful Scripts.

-Stu


this came up with nada
I'm sure it is something stupid...
anyone know how it should be amended ?

or, is there a better way to check if your exe is located somewhere in the internet cache...

Push $EXEDIR
Push $INTERNET_CACHE
Call StrStr
Pop $R0
MESSAGEBOX MB_OK "$R0"


$R0 will be "" if $INTERNET_CACHE is not in $EXEDIR

-Stu


thanks :) that makes sense...and it works now

Is there a reason why the below would not copy the file to the desktop ?
InCacheFolder: is running...just not copying
Does it have something to do with the exe [when downloaded] being run from its current location ?


Function AreWeInTheInternetCacheFolder
Push $EXEDIR ;string to search IN
Push $INTERNET_CACHE ;search string
Call StrStr
Pop $R0
strcmp $R0 "" NotInCacheFolder InCacheFolder

InCacheFolder:
;copy exe to the desktop
CopyFiles /SILENT "$EXEDIR\${FILETITLE}.exe" "$DESKTOP\${FILETITLE}.exe"


goto done

NotInInternetCacheFolder:
; do nothing and move on
done:
FunctionEnd


so, can you copy the install exe while it is executing with copyFiles ?
or, do I need to redownload/extract it if necessary

many thanks
g