can I compile a delphi xe2 with VBS code as a resource or dll

I have a few things like running SFC, defrag, and reset the page file and so on, things that can be done within windows VBScript, I am just wondering if I can compile that code as a resource and call it as needed. Thanks.

Lee


1 Solution
Solution

You can use the Windows Script Host interfaces, IActiveScript and IActiveScriptParse, to execute Javascript/VBScript from memory. You can then compile your Javascript/VBScript into a resource, extract it at runtime, and then execute it when needed.

Update: have a look at this blog article:

Adding Active Scripting to your
Delphi Win32 application

And then look at this discussion to make it work in 64bit:

Writing a scripting host in Delphi XE2 64-bit