Archive: Validation Function


Validation Function
i'm using the validation function in one of my scripts. let me sum up quickly what i'm trying to do: i have an io-page where a user can specify a filename for a file the script generates. i'm using the validation function in the leave function of the io-page to verify the inputs.

so i was trying to check, if the specified filename contains any illegal characters.

!define ILLCHARS '\/:*?"<>|'
Push "This contains:illegal chars"
Push "${ILLCHARS}"
Call Validate
Pop $0

i push ${ILLCHARS} to that function, but always get 0 as output. what am i doing wrong?

You could try one of these instead:

http://nsis.sourceforge.net/wiki/Str...for_characters

-Stu


same problem when i use that. is it something with my definition?

btw, there was a mistake in the code a posted above. i used Push '${ILLCHARS}', the code above wouldn't compile because of the quotes.


Works fine for me:


Push '\/:*?"<>|'
Push "This contains:illegal chars"
Call StrCSpn
Pop $R0 ; $R0 == :
StrCmp $R0 "" +2
MessageBox MB_OK|MB_ICONEXCLAMATION 'String contains invalid character: $R0'


-Stu

thanks stu.. don't ask me what it was ;)