Page 1 of 1 1
Topic Options
#150601 - 2005-10-26 08:46 AM @error value after copy command
daniel1982 Offline
Getting the hang of it

Registered: 2005-03-23
Posts: 77
Loc: Sydney, Australia
Hi all,

does the COPY command change the value of @error if it fails? It's not seeming to do it for me...

Top
#150602 - 2005-10-26 08:50 AM Re: @error value after copy command
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Works just fine for me.


Code:


Break On
 
COPY C:\TEMP\A.TXT C:\
'Copy error: ' + @ERROR + ' ' + @SERROR ?
 
Copy error: 2 The system cannot find the file specified.


Top
#150603 - 2005-10-26 08:58 AM Re: @error value after copy command
daniel1982 Offline
Getting the hang of it

Registered: 2005-03-23
Posts: 77
Loc: Sydney, Australia
hmm...Here is my code:
Code:
 		
Copy "\\" + $LocalServer + "\dep\collect.exe" $CompatInstallDir
$=LogToChangeLog(ReadProfileString($IniFile,"DISPLAY","Description") +
" copying from " + $LocalServer,@SERROR,@ERROR)



The directory the copy is trying to go from doesn't exist, but my log file (which is written to by LogtoChangeLog) says it completes succesfully with @error = 0?

Top
#150604 - 2005-10-26 09:48 AM Re: @error value after copy command
daniel1982 Offline
Getting the hang of it

Registered: 2005-03-23
Posts: 77
Loc: Sydney, Australia
ah, worked it out, @error is changed by ReadProfileString function...

Cheers!

Top
#150605 - 2005-10-26 01:41 PM Re: @error value after copy command
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4402
Loc: New Jersey
A common thing to do is to save the @ERROR in $ERR or something similar, and then reference the $ERR variable.

Like Code:
Copy "\\" + $LocalServer + "\dep\collect.exe" $CompatInstallDir
$EC = @ERROR $ES = @SERROR
$=LogToChangeLog(ReadProfileString($IniFile,"DISPLAY","Description") +
" copying from " + $LocalServer,$ES, $EC)



Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#150606 - 2005-10-27 03:15 PM Re: @error value after copy command
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
@ERROR/@SERROR will always contain the error/status code of the last KiXtart function/command that was executed. In your case, it's READPROFILESTRING and not COPY. This is by design.
_________________________
There are two types of vessels, submarines and targets.

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
1 registered (Allen) and 1607 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.06 seconds in which 0.029 seconds were spent on a total of 12 queries. Zlib compression enabled.

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