Frank_O Posted August 7, 2007 Posted August 7, 2007 Hi all,please don't blame me, but at the moment I'm totally dumb.Normally I use "$ret = function( ..." and of course it's working fine. But totay I tried to use"@error" and this is not working as I expected ...What am I doing wrong?gives "ok":$ret = FileCopy( "c:\Temp\ldif.log", "c:\temp\ldif.log2", 9 )if $ret = 1 Then msgbox( 64, "COPY", "Copy is done" )Else msgbox( 16, "COPY", "ERROR copying file" )EndIfgives "error":FileCopy( "c:\Temp\ldif.log", "c:\temp\ldif.log2", 9 )if @error Then msgbox( 64, "COPY", "Copy is done" )Else msgbox( 16, "COPY", "ERROR copying file" )EndIfPlease help a clueless one ...Frank
MHz Posted August 7, 2007 Posted August 7, 2007 (edited) FileCopy() does not support the @error macro so it will never set @error (e.g. @error will always be 0).Edit:FileCopy returns 0 or a non 0 result, like using True or False, so you can just do this.If FileCopy("c:\Temp\ldif.log", "c:\temp\ldif.log2", 9) Then MsgBox(64, "COPY", "Copy is done") Else MsgBox(16, "COPY", "ERROR copying file") EndIf Edited August 7, 2007 by MHz
Frank_O Posted August 7, 2007 Author Posted August 7, 2007 Hi MHz, that's cool. And now I know, that not all functions support @error ... Thank you. Frank
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now