Unable to create 32-bit com objects after upgrade to 2020

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
alindsay345
Posts: 5
Meble kuchenne na zamówienie - na wymiar - Wrocław
Joined: Wed Mar 20, 2019 12:30 pm

Unable to create 32-bit com objects after upgrade to 2020

Post by alindsay345 »

Product, version and build:PrimalScript 2020, 7.6.0.0, 7.6.138.0
32 or 64 bit version of product:64
Operating system:
32 or 64 bit OS:64

I am unable to run 32 bit VBScript code after upgrading to 2020. I have set the local machine to 32 bit in the platform section but I no longer am able to create 32-bit objects from 32-bit Active-X/Automation COM objects. I can not browse 32-bit COM objects.

Any suggestions.

User avatar
Alexander Riedel
Posts: 7342
Joined: Tue May 29, 2007 4:43 pm

Re: Unable to create 32-bit com objects after upgrade to 2020

Post by Alexander Riedel »

I run the following code on a 64 bit machine with 64 bit PrimalScript 2020. When selecting to use 32 bit, it correctly reports that it is a 32 bit process.
What indication or error messages are you seeing which point to COM objects not being available?

  1. Dim WshShell
  2.  
  3. Dim WshProcEnv
  4.  
  5. Dim system_architecture
  6.  
  7. Dim process_architecture
  8.  
  9.  
  10.  
  11. Set WshShell =  CreateObject("WScript.Shell")
  12.  
  13. Set WshProcEnv = WshShell.Environment("Process")
  14.  
  15.  
  16.  
  17. process_architecture= WshProcEnv("PROCESSOR_ARCHITECTURE")
  18.  
  19.  
  20.  
  21. If process_architecture = "x86" Then    
  22.  
  23.     system_architecture= WshProcEnv("PROCESSOR_ARCHITEW6432")
  24.  
  25.  
  26.  
  27.     If system_architecture = ""  Then    
  28.  
  29.         system_architecture = "x86"
  30.  
  31.     End if    
  32.  
  33. Else    
  34.  
  35.     system_architecture = process_architecture    
  36.  
  37. End If
  38.  
  39.  
  40.  
  41. WScript.Echo "Running as a " & process_architecture & " process on a " _
  42.  
  43.     & system_architecture & " system."
Alexander Riedel
SAPIEN Technologies, Inc.

alindsay345
Posts: 5
Joined: Wed Mar 20, 2019 12:30 pm

Re: Unable to create 32-bit com objects after upgrade to 2020

Post by alindsay345 »

See attached code. The result I get from the executing that code is:

Running as a x86 process on a AMD64 system.
Attempting to create CxScript.GlobalFunctions


The script simply exits at the line 65 where I attempt to create an object of CxScript.GlobalFunctions

There is no error. There is no other output. The execution simply ends. This code runs fine in another program that executes VB Script on this machine and is able to create the object. This worked fine in the 2019 version of PrimalScript. As far as I know, the only change was I upgraded to PrimalScript 2020.

I do not see an option to re-download 2019, so I am actually unable to use PrimalScript at this time for my work...

Also, the COM object browser does not show the CxScript component...
Attachments
test1.vbs
(2.83 KiB) Downloaded 28 times

alindsay345
Posts: 5
Joined: Wed Mar 20, 2019 12:30 pm

Re: Unable to create 32-bit com objects after upgrade to 2020

Post by alindsay345 »

I am running Windows 10 Enterprise
Ram is 16 GB RAM.
The processor is an Intel Core i7-4600U

User avatar
Alexander Riedel
Posts: 7342
Joined: Tue May 29, 2007 4:43 pm

Re: Unable to create 32-bit com objects after upgrade to 2020

Post by Alexander Riedel »

"This code runs fine in another program that executes VB Script"
VBScript and JScript are executed by CScript.exe or WScript.exe in the Windows System folder.
For the 32 bit subsystem, these are in "C:\Windows\SysWOW64"
That is what PrimalScript uses to execute your VBScript files, unless you reconfigured that in the options.
I don't know what that "other program" does, but that is how VBScripts were run by PrimalScript since 1.0.

The output you mention "Running as a x86 process on a AMD64 system." indicates that this is correct.
Nonetheless you should check that yourself by running your script with the 32-Bit CScript.exe from a command line.

As for your CxScript.GlobalFunctions object, I cannot speak to that, since I have no information as to what kind of object that is, how it was created or registered.
Typically a COM object cannot be instantiated when it is not registered properly or is missing runtime components. Many COM objects come in 32 and 64 bit flavors
and must be registered for each platform individually. I am sure you know all this, but I want to be certain.
Generally the Err variable or the system log may have information as to what happened.

In regards to not being able to download a previous PrimalScript build, I checked your account page and it seems they are all there.
downloads.png
downloads.png (421.25 KiB) Viewed 1720 times
Please note that all 32 bit versions of our products are deprecated with the 2020 releases and no longer supported as we posted here last August: https://www.sapien.com/blog/2019/08/26/ ... d-in-2020/

Last but not least, please keep in mind that I cannot see your screen, access your machine or otherwise obtain information unless you provide it.
I'd be happy to help with that object you mention, but since Google cannot find any reference to 'CxScript.GlobalFunctions', I have to assume it is something home grown.
Alexander Riedel
SAPIEN Technologies, Inc.

alindsay345
Posts: 5
Joined: Wed Mar 20, 2019 12:30 pm

Re: Unable to create 32-bit com objects after upgrade to 2020

Post by alindsay345 »

Alexander,

Thank you for your time. I appreciate your help. I am happy to provide whatever files or screenshots might help resolve this.

The "other software" is a third party application which is also the source of the "CxScript.GlobalFunctions" object. This application hosts a Windows Scripting Host engine within the application a

As stated, when run the script in PrimalScript, I get two lines in the output window
Running as a x86 process on a AMD64 system.
Attempting to create CxScript.GlobalFunctions

If I run the same script with CScript.exe using: C:\Windows\SysWOW64\cscript test1.vbs
I get 5 lines of output:
Running as a x86 process on a AMD64 system.
Attempting to create CxScript.GlobalFunctions
After attempting to create CxScript.GlobalFunctions
Created CxScript.GlobalFunctions
Completed Execution

I get the a similar (expected) result using WScript.exe where each line of output is a popup message box.

Something is different about how the CScript.exe is being invoked by PrimalScript. Again, this worked fine in the 2019 32 bit version. It simply stops executing and does NOT output any more lines and does not show any error. Adding in an On Error Resume Next before creating the object does not change the behavior in PrimalScript or CScript.exe.

I have attached a screen shot of the language settings for VB Script.

I now see the older versions. I am not sure how I missed them before, but it was my oversite.

Any Ideas on what to try next to get this to work?

Also, can I have both 2020 and 2019 versions installed at the same time?

Thanks again for your time.
Attachments
VBScriptLanguageSettings.png
VBScriptLanguageSettings.png (28.69 KiB) Viewed 1701 times

User avatar
Alexander Riedel
Posts: 7342
Joined: Tue May 29, 2007 4:43 pm

Re: Unable to create 32-bit com objects after upgrade to 2020

Post by Alexander Riedel »

Quite odd. Let's try two things:
Under the Run Script icon in the ribbon is a fold down menu. Select "Run in shell" and see what that does.
Additionally, if that works, go to the VBScript options and un-check "Capture output" for a test.
I don't know if your original script has any UI, so you may have to add this code below to your script. Otherwise you just see a flashing window. Please let me know what either one of these does.

Sub Pause(strPause)
WScript.Echo (strPause)
z = WScript.StdIn.ReadLine()
End Sub

Pause("Press Enter to continue")
Alexander Riedel
SAPIEN Technologies, Inc.

alindsay345
Posts: 5
Joined: Wed Mar 20, 2019 12:30 pm

Re: Unable to create 32-bit com objects after upgrade to 2020

Post by alindsay345 »

Ok, made some progress and interesting discoveries.

1. When using the Go icon in the Debug ribbon, the output is:
Running as a x86 process on a AMD64 system.
Attempting to create CxScript.GlobalFunctions

2. When using the Run icon in the Build and Run ribbon output is:
Microsoft (R) Windows Script Host Version 5.812
Copyright (C) Microsoft Corporation. All rights reserved.

Running as a x86 process on a AMD64 system.
Attempting to create CxScript.GlobalFunctions
After attempting to create CxScript.GlobalFunctions
Created CxScript.GlobalFunctions
Completed Execution
Execution time: 00:00:01
Exit code: 0 , 0000h

3. When using the Run icon->Run in Shell the output is:
Running as a AMD64 process on a AMD64 system.
Attempting to create CxScript.GlobalFunctions
C:\Users\qpz454\source\repos\Global Vb Script\Test\test1.vbs(64, 1) Microsoft VBScript runtime error: ActiveX component can't create object: 'CxScript.GlobalFunctions'

So currently, #1 Debugging hangs on creating the objects. #2 Run and Run Script work as expected. #3 Run in Shell is running as 64 bit.

I was using the Go (F5) to attempt to run initially.

Does this give you any ideas on how to get the debugging working?

User avatar
Alexander Riedel
Posts: 7342
Joined: Tue May 29, 2007 4:43 pm

Re: Unable to create 32-bit com objects after upgrade to 2020

Post by Alexander Riedel »

Well you were debugging, not running. That is an entirely different ball of wax.
FWIW, Run in Shell runs in the current shell. If you want a 32 bit shell, you need to select that from the combo box.
There are a number of components that have trouble with debugging. The Microsoft components that are used for VBScript debugging are kind of old and will not ever be updated.
Most of these problem stem from threading problems with the component. Imagine that the main thread of the component is stopped because the debugger has stepped or halted on a breakpoint.
A sub thread of the component, initialized when the component was created, tries to communicate with the main thread. Which doesn't answer because its stopped. Boom, its broken.

The most common way is to run your script in the debugger PAST the object creation. So instead of stepping into it and stepping through, set a breakpoint AFTER that object is created.
Make sure there is no breakpoint before that. Usually that allows the object to be created and you can debug forward from that.

All of this BTW has not changed in the 2020 version. It is all still the same old code and components.
The process hosting the debugger is scriptdriver32.exe (you can check that in the Process Explorer), so the bit level of PrimalScript itself is quite irrelevant for this.

So please try that and let me know if that helps any.
Alexander Riedel
SAPIEN Technologies, Inc.