PDA

View Full Version : Failed to add Run Script script code: Unknown error


BrandonG
06-07-2007, 03:35 PM
I am receiving the error message in the subject when a particular step executes. The step is a vbs script that runs for setting up email notifications based on certain conditions. When it fails, which it does every time the first time it hits it, I restart it and it completes successfully. The same code is called later and it also completes successfully. It just seems as though the script fails the first time only. Below is the step code.

I have verified that all of the macros referenced exist. The other thing to mention is that this step was copied from another bld script where it does NOT exhibit this problem.

Your help is appreciated.

<step action='Run Script'>
<Language>VBScript</Language>
<Script><![CDATA[dim BuildType, BUILD_EMAIL_Install, BUILD_EMAIL_SEND

Dim BUILD_EMAIL_MESSAGE
Dim BUILD_EMAIL_MESSAGE_Header, BUILD_EMAIL_MESSAGE_BUILD, BUILD_EMAIL_MESSAGE_Footer, BUILD_EMAIL_MESSAGE_Failure

BuildType = "%BUILDTYPE%"
BUILD_EMAIL_SEND=TRUE
BUILD_EMAIL_MESSAGE_BUILD=""
BUILD_EMAIL_MESSAGE_Failure=""

IF BuildType="INTEGRATION" THEN
BUILD_EMAIL_MESSAGE_BUILD = _
"DB REV: %SS_DBREV% " & vbcrlf & _
"Output: <%Delivery_Directory_BUILD%>." & vbcrlf
BUILD_EMAIL_Install=application.Macros(vbldProject ).Item("Build_Email_Install")
ElseIf BuildType="DAILY" THEN
BUILD_EMAIL_MESSAGE_BUILD = "Output: <%Delivery_Directory_BUILD%>." & vbcrlf
BUILD_EMAIL_Install=""
ElseIf BuildType="CUSTOM" THEN
BUILD_EMAIL_MESSAGE_BUILD = "The package can be found <%Delivery_Directory_BUILD%>"
BUILD_EMAIL_SEND=FALSE
End If





BUILD_EMAIL_MESSAGE_Header = _
"Product: %Main_Product_Name% " & vbcrlf & _
"Module: %Build_Module% " & vbcrlf & _
"Build Type: %BUILDTYPE% " & vbcrlf & _
"Complete Dttm: %DATETIME%" & vbcrlf & _
"Merge Module: %MSM_File%" & vbcrlf & _
"Build Status: %BUILD_STATUS%" & vbcrlf & vbcrlf

IF "%BUILD_STATUS%"<>"SUCCESS" THEN
BUILD_EMAIL_MESSAGE_Failure = _
"-- FAILURE DETAIL --" & vbcrlf & _
"Failed Step: %FailStep_Name%" & vbcrlf & _
"Step Output: %FailStep_Output%" & vbcrlf & _
"Step Status: %FailStep_Status%" & vbcrlf & vbcrlf
END IF

BUILD_EMAIL_MESSAGE_Footer = "This build was run by %BUILD_INDUCER_NAME% on %COMPUTERNAME%." & vbcrlf

BUILD_EMAIL_MESSAGE = BUILD_EMAIL_MESSAGE_Header & BUILD_EMAIL_MESSAGE_BUILD & BUILD_EMAIL_MESSAGE_Failure & BUILD_EMAIL_MESSAGE_Footer


application.Macros(vbldTempoary).Add "BUILD_EMAIL_MESSAGE",BUILD_EMAIL_MESSAGE
application.Macros(vbldTempoary).Add "BUILD_EMAIL_Install",BUILD_EMAIL_Install
application.Macros(vbldTempoary).Add "BUILD_EMAIL_SEND",BUILD_EMAIL_SEND

SET BuildType =nothing
set BUILD_EMAIL_Install =nothing
set BUILD_EMAIL_SEND =nothing

set BUILD_EMAIL_MESSAGE =nothing
set BUILD_EMAIL_MESSAGE_Header =nothing
set BUILD_EMAIL_MESSAGE_BUILD =nothing
set BUILD_EMAIL_MESSAGE_Footer =nothing
]]></Script>
<buildfailsteps type='11'>0</buildfailsteps>
<indent type='3'>1</indent>
<name>SET RECIPIENTS/MESSAGE</name>
</step>

kinook
06-07-2007, 04:49 PM
A change was made in v6.2a, intended to improve the error reporting when running script code, that we just discovered can have actually the opposite effect (at least for VBScript syntax errors), and it's possible that this change also results in the sporadic error you mention here (if so, due to a bug in the ActiveX script host or VBScript script engine).

The main download (http://www.kinook.com/Download/VisBuildProEval.exe) has been updated with a patch that backs out the problematic change to correct the 'Unknown error' (http://www.kinook.com/Forum/showthread.php?threadid=2688) rather than detailed error information when invalid VBScript code is executed inside VBP, and may also help with the sporadic error you reported here.

BrandonG
06-08-2007, 08:32 AM
the problem was with using the %failstep_output% inline because it had " in it. The error I was getting was expected end of statement.

I can't say enough how much I appreciate the quick turnaround on stuff.