2

We're using VBScript as a rather big part (>100k LOC, mostly Classes) of our software but since it's pretty old and we're quite unsure how MS support will look like in the future, we're looking for an replacement and I (as the developer) am quite unsure as well where to start to have a look at.

Do you have any hints what we could use as a replacement for VBScript?

We have the following system:

  • Our software is splitted into 2 main parts:
    • the main program (written in c++, providing a com-interface) and a
    • VBScript-part that
      • Is written by the customer to fulfil customer-specific tasks
      • Gets executed at runtime of the main program
      • Communicates via the COM interface methods with the main program

So basically at start up the main program instantiates the VBScript engine (CScript) and uses it to run the user-Code which calls functionality of the main-program via it's COM-Interfaces

Key-Requirements are:

  • User-code can call native parts of the program (via Com or some other interface)

  • User-code can run the content of a string as code ("execute" and "eval" of VBScript)

  • User-code is debuggable (breakpoints, watches,...)

  • Support of Classes for encapsulation of functionality

  • Don’t want to use a sandbox-environment (anything that needs a browser or some other host)

  • User-code must be able to call COM-functions

  • Don’t want to use JavaScript since I didn't find a (useable) debugger for it (had a look at "V8")

  • We don’t use any distributed systems with a (web-)server or something. Target system is always win32 desktop machine

  • User-code-engine (interpreter or compiler) is alive, documented, "known", so we can get support in case we need it

Things that doesn't matter

  • User-code can be compiled or interpreted
  • 1
    C++ seems the obvious choice as you then only have a single code base. Otherwise maybe Visual Basic. – cybernard Nov 9 '18 at 22:31
  • 1
    VBScript complies with (almost) all this, and is likely to remain supported in the foreseable future, to at least the lifetime of Windows 10. Specially if you have a substancial code base and that code is written by your users (instead of you), a change without a strong reason will likely anger quite a few users. – Alejandro Nov 14 '18 at 13:49
  • 2
    It does seem odd that you want to change the language used by user code. Maybe the wording of the question is unclear: Are you the "user"? And if not, who is going to rewrite the ">100k LOC"? – John Y Nov 15 '18 at 15:07
0

PHP

Although more geared toward building dynamic web pages, it can also be used for desktop programming, and since it's fundamentally a scripting language, it can be easily embeeded into other systems. Just deploy the interpreter and call it with the script you want to run and you're done, not much different from VBScript. About your requirements:

User-code can call native parts of the program (via Com or some other interface)

PHP supports calling COM and .NET components directly, and can also execute arbitrary command line programs.

User-code can run the content of a string as code ("execute" and "eval" of VBScript)

Since it's an interpreded language, it supports this out-of-box, though the eval function.

User-code is debuggable (breakpoints, watches,...)

You need to install the XDebug extension in the PHP install, and have proper tooling (like an IDE or appropriate code editor), but this can be done.

Support of Classes for encapsulation of functionality

It also support many object-oriented features, even more than VBScript.

Don’t want to use a sandbox-environment (anything that needs a browser or some other host)

Since it's run on an external interpreter, it's inherently an out-of-process operation and scripts will run in their own process, isolated from the calling program. Not exactly non-sandbox, but almost the same environment as VBScript, which is also run by an external interpreter.

User-code must be able to call COM-functions

Yes, as previously pointed.

Don’t want to use JavaScript since I didn't find a (useable) debugger for it (had a look at "V8")

Well, it's not JavaScript at all (although both have C-like syntax). There are many programs that can debug PHP (as there are that can debug JavaScript too).

We don’t use any distributed systems with a (web-)server or something. Target system is always win32 desktop machine

No need to go distributed if you don't want to, it can run alongside you main program and by deploying both together the user won't notice the difference.

User-code-engine (interpreter or compiler) is alive, documented, "known", so we can get support in case we need it

PHP is a very popular language, it powers a substancial part of websites out there, has pretty good documentation, is open source and one of the most popular on StackOverflow (it's the 4th most popular tag at this time), so you won't have any trouble asking a question about it.

Another characteristic is that being cross-platform would make a migration easy should you decide to change the Windows-only nature or go distributed if you really want. Also having lots of libraries for many common and not-so-common tasks is a nice plus.

  • Of course, this requires them to run a server (such as Apache), with all the complications that might introduce – Mawg Nov 15 '18 at 15:13
  • 1
    @Mawg Not at all. PHP isn't tied to be a web development tool, is a general purpose language (even though it's most widely used to server web pages). Just issue the proper command line like c:\php\php.exe c:\something\script.php and it'll happily run it like any other scripting language (exactly the same as VBScript). An example of such usage is the Symfony framework tooling that includes some command line utilities that are invoked in this very same way. – Alejandro Nov 15 '18 at 16:52
  • Lolx! Thanks for reminding me. I will still be running Xampp, though :-) – Mawg Nov 16 '18 at 7:50

Not the answer you're looking for? Browse other questions tagged or ask your own question.