Using MSScriptControl with Rubyscript

I am attempting to use the MSScriptcontrol with rubyscript:

  objShell = WIN32OLE.new("WScript.Shell")

  com1 = WIN32OLE.new('comobject.name')
    script = WIN32OLE.new("MSScriptControl.ScriptControl")
  script.language = "RubyScript"

  script.addObject("com1",comObject,true)

However the following error occurs:
[Bug] Segmentation fault
ruby 1.8.4 (2005-12-24) [i386-mswin32]

Any ideas? Or am I doing something wrong here?

···

--
Posted via http://www.ruby-forum.com/.

Wai-Kee Chung wrote:

I am attempting to use the MSScriptcontrol with rubyscript:

  objShell = WIN32OLE.new("WScript.Shell")

  com1 = WIN32OLE.new('comobject.name')
    script = WIN32OLE.new("MSScriptControl.ScriptControl")
  script.language = "RubyScript"

  script.addObject("com1",comObject,true)

However the following error occurs:
[Bug] Segmentation fault
ruby 1.8.4 (2005-12-24) [i386-mswin32]

Any ideas? Or am I doing something wrong here?

Ruby shouldn't exit like that, that's an extension bug or a Ruby bug,
but I can't repeat it on my workstation with the same version of Ruby.
Have you posted the complete script? Because that snippet has numerous
errors out of context: WIN32OLE and comObject don't exist.

Cheers,
Dave

Wai-Kee Chung wrote:

I am attempting to use the MSScriptcontrol with rubyscript:

  objShell = WIN32OLE.new("WScript.Shell")

  com1 = WIN32OLE.new('comobject.name')
    script = WIN32OLE.new("MSScriptControl.ScriptControl")
  script.language = "RubyScript"

  script.addObject("com1",comObject,true)

However the following error occurs:
[Bug] Segmentation fault
ruby 1.8.4 (2005-12-24) [i386-mswin32]

Any ideas? Or am I doing something wrong here?

Posting the full script would help. However, I took a swing at it and
came up with this:
p `ruby -v`
require 'win32ole'
objShell = WIN32OLE.new("WScript.Shell")

com1 = WIN32OLE.new('Excel.Application')
script = WIN32OLE.new("MSScriptControl.ScriptControl")
script.language = "RubyScript"

script.addObject("com1",com1,true)

The output is:

ruby -w winScript.rb

"ruby 1.8.2 (2004-12-25) [i386-mswin32]\n"
winScript.rb:7:in `method_missing': (WIN32OLERuntimeError)
    OLE error code:800A017C in ScriptControl
      A script engine for the specified language can not be created.
    HRESULT error code:0x80020009
      Exception occurred. from winScript.rb:7

Exit code: 1

So it looks like MSScriptControl doesn't like "RubyScript".

HtH
Cheers
Chris

···

--
Posted via http://www.ruby-forum.com/\.

Possibly you're using the One-Click Installer version of Ruby. If so,
you need to use ActiveScriptRuby. The English language page is here:

  http://arton.hp.infoseek.co.jp/index.html

Regards,
Sean

···

On 6/13/06, Wai-Kee Chung <wai-kee.chung@uk.bnpparibas.com> wrote:

I am attempting to use the MSScriptcontrol with rubyscript:

        objShell = WIN32OLE.new("WScript.Shell")

        com1 = WIN32OLE.new('comobject.name')
        script = WIN32OLE.new("MSScriptControl.ScriptControl")
        script.language = "RubyScript"

        script.addObject("com1",comObject,true)

However the following error occurs:
[Bug] Segmentation fault
ruby 1.8.4 (2005-12-24) [i386-mswin32]

Any ideas? Or am I doing something wrong here?