Henne
(Just in Town)
2008-07-03 03:07 PM
EXIST @ERROR is always = 0

EXIST ("C:\folder\file.ini")
IF @ERROR = 1
MESSAGEBOX ("FILE FOUND", @ERROR, 0)
ELSE
MESSAGEBOX ("FILE NOT FOUND", @ERROR, 0)
ENDIF

Regardless of the file is there or not, @ERROR is always 0. I cut it down to the simplest setup, but I still cannot figure it out.

@ERROR should be 1 at least with EXIST ("C:\*") but it is not.

Whats wrong?

Best regards,
Henne


AllenAdministrator
(KiX Supporter)
2008-07-03 03:16 PM
Re: EXIST @ERROR is always = 0

It's the return code you are interested in, not the error, below is how you should do handle this

 Code:
If EXIST ("C:\folder\file.ini")
  ;IF @ERROR = 1
  MESSAGEBOX ("FILE FOUND", @ERROR, 0)
ELSE
  MESSAGEBOX ("FILE NOT FOUND", @ERROR, 0)
ENDIF


Henne
(Just in Town)
2008-07-04 02:49 PM
Re: EXIST @ERROR is always = 0

Thats sounds easy :-) Thanks, Allen!
I still do not understand the @ERROR function. Couldn't find anything useful in the manual either.


Les
(KiX Master)
2008-07-04 03:30 PM
Re: EXIST @ERROR is always = 0

Probably because you were looking in the wrong place. @Error is a macro, not a function. The "functions" section however describe what @Error returns under what circumstance. You also need to realize that MessageBox() will affect the @Error in unusual ways. I think there is a FAQ on that.