Problem with JavaScript execution

I am using version 8.0.0.3390 of Finalbuilder, and since my computer updated to Windows 11 Pro 24H2, I’m getting an error message when I call actions with JavaScript.

Here is the error message:
dotnet Build - [ ZebraPicking ]
Status:
Date: 19/11/2024
Time: 07:33:22:442
End: 07:33:22:487
Duration: 00:00:00:045

Action Messages:
Working Folder : C:.NET\Clientes\Dispreu\ZebraPicking
Command Line : build C:.NET\Clientes\Dispreu\ZebraPicking\ZebraPicking.sln --configuration Release --framework net8.0-windows --verbosity normal
Error Executing script : BeforeExecute
Error en tiempo de ejecución de JavaScript
El objeto no acepta esta propiedad o método
In Action CommonScript, Line: 6
Char : 1

Here is a snapshot:

Can you help me to find a solution?

I’m really not too sure where the problem lies, with Windows of with al updated JavaScipt or with Finalbuilder.

Thanks,
Martin.

This suggests to me that BuildVer is not defined.

Hi Vincent,

I’m trying to use this script you sent me many (many) years ago:

var currentDate = new Date();
var comparisonDate = new Date(2000, 1, 1);
var difference = currentDate - comparisonDate;
BuildVer = Math.floor(difference / 86400000);

But even although it’s still marked as VBScript, it seems the script is no longer valid within FB.
I cant see hao to access the global variable BuildVer from within the script.

I have modified the script to

currentDate = Date()
comparisonDate = #2000/01/01#
difference = currentDate - comparisonDate
---> BuildVer = difference

I have also marked the script language to JavaScript.

Thanks,
Martin.

Hi Martin

I searched the forums and found the original post with the script we gave you, and it did mention that BuildVer is a FinalBuilder project variable. So you need to define the variable in your project.

I just tested the original script here (Javascript) - with the FB variable defined and it worked first time.

Hi Vincent,

Hmm, I’m begginig to think this is a machine specific error. The project is years old and has always worked fine. I have attached a snapshot of the variable declaration and the error message.



The message (in Spanish) says:
Uncontrolled exception: (“The object does not accept this propery or method”)

When I open the Finalbuilder in debug (under Visual Studio) the error message clearly states that the line 5 column 1 is the culprit. So it seems that for some reason, the BuildVer variable is no being ‘seen’ inside the JavaScript.

Regards,
Martin.

If you send the project to support @ finalbuilder .com I’ll take a look at it and see if I can figure out what is causing the issue.

Hi Vincent,

I’ve sent the project to the indicated email address.

Regards,
Martin.

I’m encountering the exact same error message with the “dotnet Publish” and “dotnet Build” actions.

And, I too just upgraded to Windows 11 Pro 24H2 and .Net 9 tools(with the latest Visual Studio 2022 17.12 and the dotnet.exe is version 9.0.100). It doesn’t matter which FinalBuilder build script that I have, they all fail with any dotnet action, that I use (dotnet Build and dotnet Publish). And, if I run the dotnet publish, with the command line parameters that FinalBuilder is using, directly in the command line prompt, it works, but fails in FinalBuilder.

Everything was working before upgrading to Windows 11 Pro 24H2 and Visual Studio 2022 17.12.

I hope that this information helps.

Exactly the same here with dotnet build and publish. If I run them just executing the command from Execute Program action, using the same command line arguments as FinalBuilder, it works okay.
Thanks for your input, it seems that it is not a machine specific error after all.
Regards,
Martin.

I just upgraded to 24h2 and can confirm it has broken scripting in FinalBuilder - looking into it now.

Ok, found the issue and a work around.

Windows 24h2 enables a policy by default that causes JScript.dll (the com dll) to load JScript9Legacy.dll rather than JScript9.dll.

JScript9Legacy.dll is a replacement engine using Chakra (which itself seems abandoned since Edge moved to using chromium).

The reason they did this was because of a security issue - which is understandable - but unforutnately it introduces a whole host of bugs they do not seem to interested in fixing (I guess it works for them).

This issue even affects some of Microsoft’s own applications (Visual Studio).

The workaround is to disable the policy

Run regedit.

navigate to:

HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Internet Explorer\Main

or

HKEY_CURRENT_USER\SOFTWARE\Policies\Microsoft\Internet Explorer\Main

Note these keys did not exist on my machine, so I added them.

Right click the Main key and select New DWORD (32-bit) Value, name the new value JScriptReplacement and the value to 0.

Restart FinalBuilder (no need to reboot).

Obviously, this is not ideal - we have been looking to replace JScript for some time - unfortunately so far our efforts have not resulted in something that is 100% backwards compatible - so we still have some work to do in this area.

1 Like

Perfect, that works just fine.
Ah, those magic words, rarely found in the same sentence: ‘legacy’ and ‘backwards compatibility’ - bring back many memories, not always good ones!
Thanks so much Vincent and the team.
Regards,
Martin.

Hi Vincent.

As you said it is a workaround and it is not ideal. Will be a FinalBuilder patch to fix it without changing the policy?
Thank you in advance.

Regards.

This is a change in Windows, not something we can patch. Ultimately we need to replace the script engines, but that is not at all an easy task. I have spent months looking into scripting engines and my conclusions are

  1. VBScript is dead - there are no viable replacements
  2. Javascript is not dead, but it a huge amount of work.

For Javascript we’re looking at using V8 (same as chrome) - however that is written in C++ and FinalBuilder & Automise are written in Delphi - and right now there are no really usable libraries to make using v8 possible. There are a few abandoned projects which no longer compile (well the c++ parts) - so we will probably need to hire a C++ dev to help with this - the last time I used C++ was in the early 90’s.

So there is no easy fix - for now the policy change will be required - we are not alone - Microsoft severely underestimated just how many people are still using active scripting. I wish they hadn’t abandoned Chakra Core as that was quite promising.

P.S - we do plan to update the installer to (optionally) make the change during install.