How to evaluate VBscript in Ruby 2.0.0 under Windows 7

I’ve run into a little more pain running my existing scripts using Ruby
2.0.0 on Windows 7. This time, I’m trying to run a script that creates
and
uses a WIN32OLE ScriptControl in order to run a VBscript script.

It was working fine under 32-bit Windows XP and Ruby 1.9.3, but now when
I
run the line

sc = WIN32OLE.new( "ScriptControl" )

I get:

WIN32OLERuntimeError: failed to create WIN32OLE object from

`ScriptControl’

Is there a new way to run VBscript in Ruby 2.0.0 and/or Windows 7? Is it
necessary to register components from the Windows side or something? If
it
matters, this machine also has Visual Studio 2010, which my old one did
not.

Hi,

2013/6/4 Eric C. [email protected]:

WIN32OLERuntimeError: failed to create WIN32OLE object from

`ScriptControl’

Is there a new way to run VBscript in Ruby 2.0.0 and/or Windows 7? Is it
necessary to register components from the Windows side or something? If it
matters, this machine also has Visual Studio 2010, which my old one did not.

This is not Ruby 2.0.0 vs Ruby 1.9.3 issue, but 64 bit vs 32 bit issue.
The msscript component was not ported to 64 bit. It’s a legacy
component and MS chose not to put the effort into migrating it to 64
bit.

If you want to use ScriptControl, you should use 32 bit Ruby
2.0.0(http://rubyforge.org/frs/download.php/76955/rubyinstaller-2.0.0-p195.exe)

Regards,
Park H.

On Jun 3, 2013 8:08 PM, “Heesob P.” [email protected] wrote:

Hi,

2013/6/4 Eric C. [email protected]:

I’ve run into a little more pain running my existing scripts using Ruby
2.0.0 on Windows 7. This time, I’m trying to run a script that creates
and
uses a WIN32OLE ScriptControl in order to run a VBscript script.

It was working fine under 32-bit Windows XP and Ruby 1.9.3, but now
when I
necessary to register components from the Windows side or something? If
it
matters, this machine also has Visual Studio 2010, which my old one did
not.

This is not Ruby 2.0.0 vs Ruby 1.9.3 issue, but 64 bit vs 32 bit issue.
The msscript component was not ported to 64 bit. It’s a legacy
component and MS chose not to put the effort into migrating it to 64
bit.

Thanks, Heesob. Is there a newer, supported way of doing the same thing?

If you want to use ScriptControl, you should use 32 bit Ruby
2.0.0(
http://rubyforge.org/frs/download.php/76955/rubyinstaller-2.0.0-p195.exe)

I’ve had to do that anyway, for Nokogiri.