Forum: Ruby Using MSScriptControl with Rubyscript

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
A0411fdc5642bcc6542b2aaee8f974bc?d=identicon&s=25 WKC C. (wkc)
on 2006-06-13 14:40
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?
Dave Burt (Guest)
on 2006-06-15 05:21
(Received via mailing list)
Wai-Kee Chung wrote:
> 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
5079a7df52bab40d7882c92add36e788?d=identicon&s=25 Chris H. (chrishulan)
on 2006-06-15 15:37
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
9b39b6eb19dbb5a3d1edcafd6d1047e3?d=identicon&s=25 Sean O. (sean)
on 2006-06-16 03:40
(Received via mailing list)
On 6/13/06, Wai-Kee Chung <wai-kee.chung@uk.bnpparibas.com> wrote:
> 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?
>
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
This topic is locked and can not be replied to.