#1
|
|||
|
|||
Simple VB Script Question?
I am trying to pass an error when 0 files are copied through the following code, in the Step tab of the script editor.
Function vbld_StepDone() if InStr(Left(vbld_AllMacros()("LASTSTEP_OUTPUT").Val ue,16), "0 file(s) copied") = 0 Then Err.Raise 1, Step.Name, "0 file(s) copied" end if When I rebuild VP 5.7 says : 'Error firing vbld_StepDone event: Error in Step script code at Line 3 column 3 (0 file(s) copied) What am I doing wrong? |
#2
|
|||
|
|||
The sample I provided in http://www.kinook.com/Forum/showthre...?threadid=1507 provides a simpler and more robust way to determine that (using the COPYFILES_COPY_COUNT macro), but in the code you posted, I think you want to look at the end of the output (Right instead of Left) and raise the error if the string is found (<> 0 instead of = 0).
|
#3
|
|||
|
|||
Thank you for the format help, currently I am using 5.7, so do not have access to the robustness of version 6. I have replaced the Err.Raise 1, Step.Name, "0 file(s) copied" with a MsgBox, and that runs fine. Is there some VB system file that I do not have loaded?
|
#4
|
|||
|
|||
The COPYFILES_COPY_COUNT temp macro is also available in v5.7. At any rate, it sounds like it's doing what's intended -- failing the build if the count is 0.
|
#5
|
|||
|
|||
The code works fine, it is the trying to get the Failure Step; which is to email a user, which is not getting called. There apparently is something funky in the script line Err.Raise 1, Step.Name, "0 file(s) copied". The rebuild states 'Error firing vbld_StepDone event'. Any ideas?
|
#6
|
|||
|
|||
That's the correct error message, since you're raising an error from the vbld_StepDone event. Do you perhaps still have Ignore failure checked?
|
#7
|
|||
|
|||
You are the wizard!
Thank you very much for your patience and time. |
|
|