Page 1 of 1 1
Topic Options
#188538 - 2008-07-03 03:07 PM EXIST @ERROR is always = 0
Henne Offline
Just in Town

Registered: 2006-08-17
Posts: 3
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

Top
#188539 - 2008-07-03 03:16 PM Re: EXIST @ERROR is always = 0 [Re: Henne]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4545
Loc: USA
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

Top
#188566 - 2008-07-04 02:49 PM Re: EXIST @ERROR is always = 0 [Re: Allen]
Henne Offline
Just in Town

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

Top
#188568 - 2008-07-04 03:30 PM Re: EXIST @ERROR is always = 0 [Re: Henne]
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
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.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 248 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.049 seconds in which 0.023 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org