[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

prob only with ruby

Junkone

1/8/2008 8:06:00 PM

Hello
i am using ole automation to drive some of my processes. the following
code would run properly in other languages like vbscript. but it fails
only in ruby
application = WIN32OLE.new("Broker.Application")


analysis=application.analysis()

analysis.Filter(0, "market") = 3 # use nasdaq only << ruby
does not allow setting values like this. it errors syntax error,
unexpected '=', expecting $end. however this assignmetn is valid in
vbscript for the same object. is there any other way of doing it.

7 Answers

John Wells

1/8/2008 9:01:00 PM

0

On Jan 8, 2008 3:10 PM, Junkone <junkone1@gmail.com> wrote:
> Hello
> i am using ole automation to drive some of my processes. the following
> code would run properly in other languages like vbscript. but it fails
> only in ruby
> application = WIN32OLE.new("Broker.Application")
>
>
> analysis=application.analysis()
>
> analysis.Filter(0, "market") = 3 # use nasdaq only << ruby
> does not allow setting values like this. it errors syntax error,
> unexpected '=', expecting $end. however this assignmetn is valid in
> vbscript for the same object. is there any other way of doing it.

I'm not a vbscript guy, but did you try:

myvar = analysis.Filter(0, "market")
myvar = 3

?

Junkone

1/8/2008 9:58:00 PM

0

On Jan 8, 4:00 pm, John Wells <li...@sourceillustrated.com> wrote:
> On Jan 8, 2008 3:10 PM, Junkone <junko...@gmail.com> wrote:
>
> > Hello
> > i am using ole automation to drive some of my processes. the following
> > code would run properly in other languages like vbscript. but it fails
> > only in ruby
> > application = WIN32OLE.new("Broker.Application")
>
> >   analysis=application.analysis()
>
> > analysis.Filter(0, "market") = 3  # use nasdaq only          << ruby
> > does not allow setting values like this. it errors syntax error,
> > unexpected '=', expecting $end. however this assignmetn is valid in
> > vbscript for the same object. is there any other way of doing it.
>
> I'm not a vbscript guy, but did you try:
>
> myvar = analysis.Filter(0, "market")
> myvar = 3
>
> ?

Nope. it does not work
b=analysis.Filter(0, "market") #= 3 # use nasdaq only
b=3
It does not change anything at all.
However if i ran a similar code in vbscript, it does the magic.

set application = CreateObject("Broker.Application")
application.visible=1
set analysis=application.analysis()
analysis.Filter( 0, "market" ) = 3

so something is wrong with the way ruby does automation.

Stefan Schmiedl

1/8/2008 10:26:00 PM

0

On Tue, 8 Jan 2008 13:58:11 -0800 (PST)
Junkone <junkone1@gmail.com> wrote:

> Nope. it does not work
> b=analysis.Filter(0, "market") #= 3 # use nasdaq only
> b=3
> It does not change anything at all.
> However if i ran a similar code in vbscript, it does the magic.
>
> set application = CreateObject("Broker.Application")
> application.visible=1
> set analysis=application.analysis()
> analysis.Filter( 0, "market" ) = 3
>
> so something is wrong with the way ruby does automation.

Maybe the library does not know about the default property,
which VB uses...

So assuming that you're assigning the .Value property, try

analysis.Filter(0, "market").Value = 3

in ruby.

I wonder ... does

p analysis.Filter(0, "market").methods

return any useful information?

s.

Masaki Suketa

1/8/2008 10:34:00 PM

0

Hello,

Junkone wrote:
> Nope. it does not work
> b=analysis.Filter(0, "market") #= 3 # use nasdaq only
> b=3
> It does not change anything at all.
> However if i ran a similar code in vbscript, it does the magic.
>
> set application = CreateObject("Broker.Application")
> application.visible=1
> set analysis=application.analysis()
> analysis.Filter( 0, "market" ) = 3
>
> so something is wrong with the way ruby does automation.
>

Ruby does not support the following syntax, so Win32OLE
does not support.
> analysis.Filter( 0, "market" ) = 3

Instead, does the following script work?

analysis.setproperty('Filter', 0, "market", 3)

Regards,
Masaki Suketa

Junkone

1/9/2008

0

On Jan 8, 5:25 pm, Stefan Schmiedl <s...@xss.de> wrote:
> On Tue, 8 Jan 2008 13:58:11 -0800 (PST)
>
> Junkone <junko...@gmail.com> wrote:
> > Nope. it does not work
> > b=analysis.Filter(0, "market") #= 3  # use nasdaq only
> >        b=3
> > It does not change anything at all.
> > However if i ran a similar code in vbscript, it does the magic.
>
> > set application = CreateObject("Broker.Application")
> > application.visible=1
> > set analysis=application.analysis()
> > analysis.Filter( 0, "market" ) = 3
>
> > so something is wrong with the way ruby does automation.
>
> Maybe the library does not know about the default property,
> which VB uses...
>
> So assuming that you're assigning the .Value property, try
>
>   analysis.Filter(0, "market").Value = 3
>
> in ruby.
>
> I wonder ... does
>
>   p analysis.Filter(0, "market").methods
>
> return any useful information?
>
> s.

it does something useful within the application. thats why i use it.
it configures one of the windows within the app.

Junkone

1/9/2008 12:04:00 AM

0

On Jan 8, 5:33 pm, Masaki Suketa <masaki.suk...@nifty.ne.jp> wrote:
> Hello,
>
> Junkone wrote:
>
>  > Nope. it does not work
>  > b=analysis.Filter(0, "market") #= 3  # use nasdaq only
>  >        b=3
>  > It does not change anything at all.
>  > However if i ran a similar code in vbscript, it does the magic.
>  >
>  > set application = CreateObject("Broker.Application")
>  > application.visible=1
>  > set analysis=application.analysis()
>  > analysis.Filter( 0, "market" ) = 3
>  >
>  > so something is wrong with the way ruby does automation.
>  >
>
> Ruby does not support the following syntax, so Win32OLE
> does not support.
>  > analysis.Filter( 0, "market" ) = 3
>
> Instead, does the following script work?
>
>    analysis.setproperty('Filter', 0, "market", 3)
>
>    Regards,
>    Masaki Suketa

bingo. analysis.setproperty('Filter', 0, "market", 4) works
beautifylly. masaki is one smart. how did you figure it out. i am
wondering.

Masaki Suketa

1/9/2008 12:46:00 AM

0

Hello,

Junkone wrote:
>> Instead, does the following script work?
>>
>> analysis.setproperty('Filter', 0, "market", 3)
>>
>> Regards,
>> Masaki Suketa
>
> bingo. analysis.setproperty('Filter', 0, "market", 4) works
> beautifylly. masaki is one smart. how did you figure it out. i am
> wondering.

Because I'm a maintainor of Win32OLE. :-)
To support property setting with argument like Filter,
WIN32OLE#setproperty method is provided.

Regards,
Masaki Suketa