Urgent - JScript scripts will not run

@emre

Got an urgent issue, I am installing on a client’s system and none of my scripts will work. I did a test function just returning a value to double check, the same error is returned for all scripts:

If a script is run outside the script editor, it will crash SambaPOS.

SambaPOS is v5.1.61 using SQL Express 2008 on Windows Server Standard 2008

I am wondering if it is an OS issue, is there any settings I need to configure on Windows Server that might be blocking JScript?

Unfortunately I never experienced something like that with JScript before .Maybe you can try upgrading .net framework.

Do you think that error is related to JScript or anything else I can look into that may be disabled / blocked on the server?

I lost my connection their internet went down… good timing! :stuck_out_tongue:

I checked .net before I am sure they had 3.5, 4 and 4.5 installed

I notice Windows PowerShell isn’t installed - do you think it’s related to that?

If I test if I can run a JScript script using Windows Scripting Host would that be using similar prerequisites to what SambaPOS uses?

It may give an idea.

That error message coming from a “NotImplementedException” however it is really hard to guess where it is coming from. SambaPOS uses ClearScript library to execute JScript. There might be a missing requirement for ClearScript or might be something related with OS. Maybe this is a SambaPOS bug. I even don’t know if V5 working on Windows Server 2008 Standard for somewhere else.

Created a test.js file:

WScript.Echo("test");

Works fine using both cscript and wscript. So JScript works in Windows.

Current .net framework installed

The client is going to just get their IT guy to do all the windows updates because it appears this server has never been updated… scary thought! I’ll let them deal with that first before we investigate further.

1 Like

BTW this was the original error thrown by SambaPOS if the script is not run from the script editor:

-----------------------------
[General Info]

Application: SambaPOS
Version:     5.1.61
Region:      en
DB:          SQ
Machine:     SERVER
User:        Administrator
Date:        3/11/2017
Time:        3:13 PM

User Explanation:

Administrator said ""
-----------------------------

[Exception Info 1]

Top-level Exception
Type:        System.NotImplementedException
Message:     The method or operation is not implemented.
Source:      ClearScript
Stack Trace: at Microsoft.ClearScript.Windows.IActiveScriptProperty.SetProperty(ScriptProp property, IntPtr pVarIndex, Object& value)
   at Microsoft.ClearScript.Windows.ActiveScriptWrapper32..ctor(String progID, WindowsScriptEngineFlags flags)
   at Microsoft.ClearScript.Windows.ActiveScriptWrapper.Create(String progID, WindowsScriptEngineFlags flags)
   at Microsoft.ClearScript.Windows.WindowsScriptEngine.<>c__DisplayClass15_0.<.ctor>b__0()
   at Microsoft.ClearScript.ScriptEngine.ScriptInvoke[T](Func`1 func)
   at Microsoft.ClearScript.Windows.WindowsScriptEngine..ctor(String progID, String name, WindowsScriptEngineFlags flags)
   at Microsoft.ClearScript.Windows.JScriptEngine..ctor(String progID, String name, WindowsScriptEngineFlags flags)
   at Microsoft.ClearScript.Windows.JScriptEngine..ctor(String name, WindowsScriptEngineFlags flags)
   at Samba.Services.Implementations.ExpressionModule.ExpressionEngine.GetEngine() in C:\Users\Emre\Documents\GitHub\SambaPOSPro\Samba.Services\Implementations\ExpressionModule\ExpressionEngine.cs:line 31
   at Samba.Services.Implementations.ExpressionModule.ExpressionEngine.Invoke(String expression, String function, Object dataObject, Object[] args) in C:\Users\Emre\Documents\GitHub\SambaPOSPro\Samba.Services\Implementations\ExpressionModule\ExpressionEngine.cs:line 173
   at Samba.Services.Implementations.ExpressionModule.ExpressionService.InvokeScript(String handlerFunction, Object dataObject) in C:\Users\Emre\Documents\GitHub\SambaPOSPro\Samba.Services\Implementations\ExpressionModule\ExpressionService.cs:line 52
   at System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2)
   at Samba.Modules.AutomationModule.ActionProcessors.ExecuteScript.Process(ActionData actionData, RuleExecutionContext context)
   at Samba.Services.Common.RuleActionTypeRegistry.ProcessAction(String actionType, ActionData actionData, RuleExecutionContext context) in C:\Users\Emre\Documents\GitHub\SambaPOSPro\Samba.Services\Common\RuleActionTypeRegistry.cs:line 39
   at Samba.Services.Implementations.AutomationModule.AutomationService.ProcessAction(String actionType, ActionData actionData, RuleExecutionContext context) in C:\Users\Emre\Documents\GitHub\SambaPOSPro\Samba.Services\Implementations\AutomationModule\AutomationService.cs:line 42
   at Samba.Services.Implementations.AutomationModule.RuleExecutor.ExecuteWithoutLogging(Object dataParameter) in C:\Users\Emre\Documents\GitHub\SambaPOSPro\Samba.Services\Implementations\AutomationModule\RuleExecutor.cs:line 110
   at Samba.Services.Implementations.AutomationModule.RuleExecutor.ExecuteWith(Object dataParameter) in C:\Users\Emre\Documents\GitHub\SambaPOSPro\Samba.Services\Implementations\AutomationModule\RuleExecutor.cs:line 62
   at Samba.Services.Implementations.AutomationModule.NotificationService.NotifyEvent(String eventName, Object dataParameter, AppState appState) in C:\Users\Emre\Documents\GitHub\SambaPOSPro\Samba.Services\Implementations\AutomationModule\NotificationService.cs:line 24
   at Samba.Presentation.Services.Implementations.AutomationModule.NotificationClient.NotifyEvent(String eventName, Object dataObject)
   at Samba.Modules.AutomationModule.WidgetCreators.AutomationButtonWidgetViewModel.OnItemClicked(AutomationButtonWidgetViewModel obj)
   at Microsoft.Practices.Prism.Commands.DelegateCommand`1.<>c__DisplayClass6.<.ctor>b__2(Object o)
   at Microsoft.Practices.Prism.Commands.DelegateCommandBase.Execute(Object parameter)
   at Microsoft.Practices.Prism.Commands.DelegateCommandBase.System.Windows.Input.ICommand.Execute(Object parameter)
   at MS.Internal.Commands.CommandHelpers.CriticalExecuteCommandSource(ICommandSource commandSource, Boolean userInitiated)
   at System.Windows.Controls.Primitives.ButtonBase.OnClick()
   at System.Windows.Controls.Button.OnClick()
   at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
   at System.Windows.UIElement.OnMouseLeftButtonUpThunk(Object sender, MouseButtonEventArgs e)
   at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
   at System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e)
   at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
   at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
   at System.Windows.Input.InputManager.ProcessStagingArea()
   at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
   at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
   at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
   at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)

-----------------------------

[Assembly Info]

mscorlib, Version=4.0.0.0
Samba.Services, Version=1.0.0.0
Samba.Domain, Version=1.0.0.0
Samba.Infrastructure.Data, Version=1.0.0.0
System.ComponentModel.Composition, Version=4.0.0.0
Samba.Presentation.Services, Version=1.0.0.0
System.Core, Version=4.0.0.0
PresentationCore, Version=4.0.0.0
DevExpress.Xpf.LayoutControl.v14.1, Version=14.1.13.0
System.Xml, Version=4.0.0.0
DevExpress.Xpf.Grid.v14.1, Version=14.1.13.0
System, Version=4.0.0.0
DevExpress.Xpf.Grid.v14.1.Core, Version=14.1.13.0
WindowsBase, Version=4.0.0.0
System.Xaml, Version=4.0.0.0
PresentationFramework, Version=4.0.0.0
Samba.Infrastructure, Version=1.0.0.0
Microsoft.Practices.Prism, Version=4.0.0.0
System.Runtime.Serialization, Version=4.0.0.0
Microsoft.Practices.Prism.MefExtensions, Version=4.0.0.0
DevExpress.Xpf.Core.v14.1, Version=14.1.13.0
System.Windows.Forms, Version=4.0.0.0
System.Drawing, Version=4.0.0.0
Samba.Persistance, Version=1.0.0.0
Stateless, Version=1.0.0.0
PropertyTools, Version=2012.4.14.1
Samba.Localization, Version=1.0.0.0
ReachFramework, Version=4.0.0.0
EntityFramework, Version=6.0.0.0
FluentValidation, Version=3.4.0.0
Microsoft.CSharp, Version=4.0.0.0
Omu.ValueInjecter, Version=2.3.0.0
Microsoft.Practices.ServiceLocation, Version=1.0.0.0

-----------------------------

[System Info]

Operating System
-Microsoft® Windows Server® 2008 Standard
--CodeSet = 1252
--CSDVersion = Service Pack 1
--CurrentTimeZone = 180
--FreePhysicalMemory = 2365752
--OSArchitecture = 32-bit
--OSLanguage = 1033
--ServicePackMajorVersion = 1
--ServicePackMinorVersion = 0
--Version = 6.0.6001

Machine
-SERVER
--Manufacturer = HP
--Model = ProLiant ML110 G6
--TotalPhysicalMemory = 4294012928
--UserName = SERVER\Administrator

-----------------------------


Hmm that probably fails because an old version of JScript is installed on the system. I enabled it to use newer version to be able to use JSON class.

However I don’t know how you can upgrade it. Installing a better IE version may help.

2 Likes

Hi, I am not sure if this can be for this forum. I am working a samba project involving scripting and was progressing well. The windows 11 asked to update and it took long. The now all my scripts are not working. example of simple script shown


This could be a windows thing but can someone help. Has anyone ever faced this? windows 11 in domain use.

With W11 24H2 there’s an updated scripting engine.

To enable the legacy engine, save the following with .REG extension and apply it and see if that makes a difference.

Windows Registry Editor Version 5.00
 
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Internet Explorer\Main]
"JScriptReplacement"=dword:00000000

thanks very much. that has resolved the issue

@memo From your research on this, is the upgraded scripting engine being installed on all editions with Win11 24H2, as I am pretty sure I have setup and have some customers who will be on Win 11 Home / Pro with 24H2 and no scripting errors or unexpected crashes have been reported (yet… :scream:). Although those customers may not be on the latest SambaPOS version and some will definitely still be on v5.3.0 - not sure if this issue is only happening in the more recent releases of SamabPOS…

It would appear that it is rolled out for all installs. You mention using the IoT version of windows and I am not sure if that has a different update channel/schedule.

We’ve encountered issues with 1-2 second delay when executing some scripts with v5.3.

No, not on this topic…

I use Win 10 IoT on most POS terminals we sell, but on Windows tablets its mostly consumer Windows tablets we sell (due to price) and those come with Win 11 Home or Pro. It’s only those, or any setups either using customer’s existing hardware or with alternative hardware like mini PC or desktop computers where we currently would be using Windows 11.

We still haven’t started using Win 11 IoT as it’s only recently been adopted by all our hardware suppliers. Haven’t even tried out Win 11 IoT The first LTSC edition of Win 11 IoT Enterprise that is available is actually 24H2, and something like scripting for security concerns I’d definitely expect it to also be included in IoT. It is mostly feature updates that you don’t get on the IoT LTSC channel, so like 24H2 remains as 24H2 forever and only gets critical and security updates, but no feature updates. This is great for POS terminals and it’s end of life is not until 2034.

(Unrelated side note just for clarity - Win 11 IoT has been out since 21H2 under the general availability channel, but that has the same shorter support lifetimes as Home / Pro editions, e.g. 24H2 end of support is 2027, but would be reset by future feature updates. Microsoft only release on the LTSC (long term support channel) every 2-3 years, so the last release was Win 10 IoT 21H2, then went to Win 11 IoT 24H2 3 years later. Hardware suppliers will only offer Win 11 IoT LTSC as it makes most sense for a POS terminal - you don’t need feature updates and its more important to have a stable system for up to 10 years)

I mentioned IoT because I’ve seen you mention it other posts; I didn’t mean to imply this post.

1 Like