Skip to content
⌘ NSIS Forum Archive

Validation Function

5 posts

Yathosho#

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?
Afrow UK#
You could try one of these instead:



-Stu
Yathosho#
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.
Afrow UK#
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