Kinook Software Forum

Kinook Software Forum (https://www.kinook.com/Forum/index.php)
-   [VBP] General Discussion (https://www.kinook.com/Forum/forumdisplay.php?f=2)
-   -   Error firing vbld_BuildStarting event (https://www.kinook.com/Forum/showthread.php?t=4796)

bwilder 02-23-2011 10:44 AM

Error firing vbld_BuildStarting event
 
Hi,
Suddenly, today, a script of mine that has been running successfully for months failed to run with the following error in the output panel:

Error firing vbld_BuildStarting event: Error in Project (VBScript) script code at Line 51, Column 6
Build ended.

The build didn't even start, just sat there for a few seconds and eventually dumped out the error. The issue persists even when using backup copies of the scripts that are weeks or months old, so I doubt that it's the actual script that is causing the issue. Something must've changed with the environment, but I'm not sure how to proceed.

Where is the vbld_BuildStarting event located?
What VBScript should I look at to troubleshoot this?

Visual Build Professional Version 7.2a

kinook 02-23-2011 10:52 AM

Somewhere in the project script code (View | Other Windows | Script Editor -> Project tab). It's failing on line 51 (which could be the event function or a function called by it). Pressing F8 (Go | Last Error) after the error occurs should also take you there.

bwilder 02-23-2011 11:04 AM

Thanks,
The full script is posted below and the failing method appears to be the CreateObject() method in the vbld_BuildStarting() method. Do you have any thoughts on what would causing this or how I would go about fixing it?

Code:

Sub CreateShortcut(target, sname)

        Set objWshShell = CreateObject("Wscript.Shell")
       
        ' Read desktop path using WshSpecialFolders object
        strDesktopPath = objWshShell.SpecialFolders("Desktop")
       
        ' Create a shortcut object on the desktop
        Set objShortcut = objWshShell.CreateShortcut(strDesktopPath & "\" & sname & ".lnk")
       
        ' Set shortcut object properties and save it
        objShortcut.TargetPath = target
        objShortcut.Save
End Sub

Function IsVS2003Installed()
        IsVS2003Installed = Len(Application.ExpandMacros("%REG_READ(" & _
                "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.1\InstallDir, )%")) > 1
End Function

Function IsVS2005Installed()
        IsVS2005Installed = Len(Application.ExpandMacros("%REG_READ(" & _
                "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\InstallDir, )%")) > 1       
End Function

Function IsVS2008Installed()
        IsVS2008Installed = Len(Application.ExpandMacros("%REG_READ(" & _
                "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\9.0\InstallDir, )%")) > 1
End Function

Function IsVB6Installed()
        IsVB6Installed = Len(Application.ExpandMacros("%REG_READ(" & _
                "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\6.0\Setup\Microsoft Visual Basic\ProductDir, )%")) > 1
End Function

Function IsVC6Installed()
        IsVC6Installed = Len(Application.ExpandMacros("%REG_READ(" & _
                "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\6.0\Setup\Microsoft Visual C++\ProductDir, )%")) > 1
End Function

Function IsVSSInstalled()
        IsVSSInstalled = Len(Application.ExpandMacros("%REG_READ(" & _
                "HKCR\CLSID\{783CD4E4-9D54-11CF-B8EE-00608CC9A71F}\InprocServer32\, )%")) > 1
End Function

Sub vbld_BuildStarting()
dim a,b
a= 0
b= Builder.LaunchType
if a=b then
    CreateObject("wscript.shell").run "build\SenderResult.exe  submitstatus$b1",vbhide 
End If

End Sub




Sub vbld_BuildDone(status)
dim a,b
a=0
b= Builder.LaunchType
if a=b then
    CreateObject("wscript.shell").run "build\SenderResult.exe buildresult$"&status&" submitstatus$"&"b2",vbhide
 End If

End Sub


kinook 02-23-2011 11:13 AM

Actually, it's probably failing on the .run method call, not CreateObject. You can determine that by separating into two lines:
Code:

Set shell = CreateObject("wscript.shell")
shell.run "build\SenderResult.exe  submitstatus$b1",vbhide

and seeing which line fails.

bwilder 02-23-2011 11:26 AM

You were right, the "shell.run" line failed. As you might've guessed, I didn't build this script myself, I'm just maintaining it. Are the last 20 lines or so in my source standard or custom?

Code:

Sub vbld_BuildStarting()
dim a,b
a= 0
b= Builder.LaunchType
if a=b then
    CreateObject("wscript.shell").run "build\SenderResult.exe  submitstatus$b1",vbhide 
End If

End Sub




Sub vbld_BuildDone(status)
dim a,b
a=0
b= Builder.LaunchType
if a=b then
    CreateObject("wscript.shell").run "build\SenderResult.exe buildresult$"&status&" submitstatus$"&"b2",vbhide
 End If

End Sub

I've checked for this in another installation of the same version of the product and I don't see it there.
If it's standard, do you have any idea what would cause it to suddenly start failing?

Thank you!

kinook 02-23-2011 11:37 AM

Visual Build does not have any predefined any script events. I don't know what SenderResult.exe is or what it does. Since the code uses a relative path, you might make sure that executable exists relative to the .bld file and that you have Tools | Application Options | General | Set current directory to project folder after loading and saving projects checked.
http://www.kinook.com/VisBuildPro/Manual/miscopt.htm

bwilder 02-23-2011 12:12 PM

Yup, that did it. Someone moved the target files that were being called by that custom script.

Thanks for your help!


All times are GMT -5. The time now is 06:27 AM.


Copyright © 1999-2023 Kinook Software, Inc.