Options Object for Delphi in FinalBuilder 7

I'm in the process of upgrading from FinalBuilder 5 to FinalBuilder 7 and hitting some problems with my BeforeAction scripts.

The following worked in FinalBuilder 5:

Dim DelphiOptions
DelphiOptions = GetOptionsObject("Borland Delphi")
If Action.CompilerVersion = 4 Then
  Action.LibraryPath = Replace(DelphiOptions.D7LibraryPath, "..\..\Newlook\", "..\Newlook\", 1, -1, 1)
ElseIf Action.CompilerVersion = 11 Then
  Action.LibraryPath = Replace(DelphiOptions.D2006LibraryPath, "..\..\Newlook\", "..\Newlook\", 1, -1, 1)
End If

In FinalBuilder 7, that fails with the following error:
Object required: 'DelphiOptions'

I eventually figured out that the GetOptionsObject probably needs to be changed to:

DelphiOptions = GetOptionsObject("Embarcadero Delphi")

But when I try to refer to the D7LibraryPath property, it now fails with the following error:
Object doesn't support this property or method

Have the various LibraryPath properties changed name as well? If so, are the new ones documented anywhere? Is there some technique to enumerate the properties of a VBScript object from inside a script?

The documentation in the FinalBuilder help still refers to FinalBuilder 6 and uses GetOptionsObject("Borland Delphi") and D6LibraryPath as above in it's examples so that's doesn't really help much.

I did try using the Microsoft Script Debugger to debug the BeforeAction scripts and set breakpoints per the Final Builder script debugging help in the hope that I could inspect the DelphiOptions object and try to see it's properties from there but this doesn't seem to work. The Microsoft Script Debugger which I downloaded and installed does actually launch when it hits the breakpoint but with an empty window and no apparent context so I was stumped.

Has anyone ever got that to work or do you actually have to use Visual Studio .NET to debug FinalBuilder action scripts, contrary to the help?

The help says that you can use the Active Script Debugger but perhaps that is a different beast from the Microsoft Script Debugger. If it is different, I couldn't find anywhere on MSDN to download it. Everything seems to point to the Microsoft Script Debugger.

Cheers,
Paul.

Hi Paul

In short, it's a bug. I did change the name of the options object to reflect the new owners of the delphi brand, but completely forgot about the scripting access to the object using the name. Using "Embarcadero Delphi" should have worked, were it not for the fact that the "Embarcadero Delphi for .Net" options object was being matched first and being returned, and that the new scripting implementation is more fussy about the syntax when returning an object. 

This build includes the fix : https://www.finalbuilder.com/downloa...00_637.exe

When assigning an object to a variable in VBScript, the Set keyword is required, so it should be :

Dim DelphiOptions
Set DelphiOptions = GetOptionsObject("Borland Delphi")

The FB6 and earlier scripting implementation seemed work without the Set keyword, but poring over the code for hours left me non the wiser as to how they achieved that.

I changed the GetOptionsObject function to handle multiple aliases for options names, so you can use "Borland Delphi" (for backwards compatibility) or "Embarcadero Delphi" or just "Delphi".

Code completion in the script debugger only currently works if you specify "Borland Delphi", I'll take a look at how that can be extended tomorrow  to handle the aliased names(and I noticed it's a bit out of date too, missing some properties).

As for script debugging, once you have any version of Visual Studio.NET installed on a machine, it takes over script debugging duties and the old Microsoft Script Debugger no longer works.

 

Hi Vincent

Thanks for the prompt reply and updated build. I'm downloading it now. Great service and support as always!

Pity about Microsoft Script Debugger not working anymore as I don't have Visual Studio .NET since we're a Delphi shop :-) I assume there isn't a free download version or Express Edition somewhere for the few times I need to debug an action script?

Interesting about the Set issue. We have our own VBScript-alike implementation as well in our application and we don't require the Set either so I'm not sure whether you're tripping over a parser issue or a run-time issue in your implementation. Object references are just IDispatch wrapped variants from memory...

Cheers, Paul.