Yathosho
20th October 2005 13:35 UTC
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
      20th October 2005 19:38 UTC
      You could try one of these instead:
      
      http://nsis.sourceforge.net/wiki/Str...for_characters
      
      -Stu
     
    
      Yathosho
      20th October 2005 20:57 UTC
      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
      20th October 2005 21:00 UTC
      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
    
 
    
      Yathosho
      20th October 2005 21:42 UTC
      thanks stu.. don't ask me what it was ;)