dodger42 Posted August 4, 2006 Share Posted August 4, 2006 Hey all, I use filecopy() in a script, but I want to log the success/failure of the command. I know in the documentation it says the following: Return Value Success: Returns 1. Failure: Returns 0. But how do I access those return values? My function call is like this: FileCopy ( $CompletePath & "mission" & $NextMis & ".mis", $CompletePath & "currentmis.mis",1 ) Regards, D Link to comment Share on other sites More sharing options...
Paulie Posted August 4, 2006 Share Posted August 4, 2006 (edited) Hey all, I use filecopy() in a script, but I want to log the success/failure of the command. I know in the documentation it says the following: Return Value Success: Returns 1. Failure: Returns 0. But how do I access those return values? My function call is like this: FileCopy ( $CompletePath & "mission" & $NextMis & ".mis", $CompletePath & "currentmis.mis",1 ) Regards, D Catch them in a variable $variable = FileCopy ( $CompletePath & "mission" & $NextMis & ".mis", $CompletePath & "currentmis.mis",1 ) If $variable = 1 then ;Do something Else ;Do something else Endif Edited August 4, 2006 by Paulie Link to comment Share on other sites More sharing options...
taurus905 Posted August 4, 2006 Share Posted August 4, 2006 dodger42, I think you want to look at how to use @error. Do a search in the help file. If @error = 1 Then MsgBox(0, "Successful", "Yes") If @error = 0 Then MsgBox(0, "Successful", "No") taurus905 "Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs Link to comment Share on other sites More sharing options...
dodger42 Posted August 4, 2006 Author Share Posted August 4, 2006 Thanks Paulie. Does this also exectuve the filecopy or just test? Link to comment Share on other sites More sharing options...
zeroZshadow Posted August 4, 2006 Share Posted August 4, 2006 u can catch the returns of ALL the functions, even the ones u make yourself (aslong as there is an "return" in it). *If u thought life couldn't get worse, u meet me *<guy> What would you give my little sister to unzip ?<friend> 10 bucks<guy> No, i mean like Winzip... Link to comment Share on other sites More sharing options...
Paulie Posted August 4, 2006 Share Posted August 4, 2006 dodger42, I think you want to look at how to use @error. Do a search in the help file. If @error = 1 Then MsgBox(0, "Successful", "Yes") If @error = 0 Then MsgBox(0, "Successful", "No") taurus905I don't think 'Filecopy' sets @error but I could be wrong @Dodger- this executes it too Link to comment Share on other sites More sharing options...
taurus905 Posted August 4, 2006 Share Posted August 4, 2006 I don't think 'Filecopy' sets @error but I could be wrongPaulie, You are right. That's what I get for posting without testing first. Global $Copied _Copy_File() If $Copied Then MsgBox(0, "Successful", "Yes") If $Copied = 0 Then MsgBox(0, "Successful", "No") Exit Func _Copy_File() $Copied = FileCopy($CompletePath & "mission" & $NextMis & ".mis", $CompletePath & "currentmis.mis",1 ) Return $Copied EndFunc taurus905 "Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs Link to comment Share on other sites More sharing options...
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