Kinook Software Forum

Go Back   Kinook Software Forum > Visual Build Professional > [VBP] General Discussion
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 02-01-2006, 02:47 PM
Scotty Scotty is online now
Registered User
 
Join Date: 01-30-2006
Posts: 6
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?
Reply With Quote
  #2  
Old 02-01-2006, 03:22 PM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
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).
Reply With Quote
  #3  
Old 02-01-2006, 03:27 PM
Scotty Scotty is online now
Registered User
 
Join Date: 01-30-2006
Posts: 6
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?
Reply With Quote
  #4  
Old 02-01-2006, 03:43 PM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
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.
Reply With Quote
  #5  
Old 02-01-2006, 03:48 PM
Scotty Scotty is online now
Registered User
 
Join Date: 01-30-2006
Posts: 6
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?
Reply With Quote
  #6  
Old 02-01-2006, 03:54 PM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
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?
Reply With Quote
  #7  
Old 02-01-2006, 03:57 PM
Scotty Scotty is online now
Registered User
 
Join Date: 01-30-2006
Posts: 6
You are the wizard!
Thank you very much for your patience and time.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



All times are GMT -5. The time now is 07:12 AM.


Copyright © 1999-2023 Kinook Software, Inc.