Dennis Misener
3/29/2006 2:46:00 PM
In article <200603291215.k2TCFRiK012334@userg501.nifty.com>,
masaki.suketa@nifty.ne.jp says...
Progress!!
Good news: It returns correct output parameters :-)
Bad news: It only works once!! :-( But that could my logic error or
Mindjets API problem.
Thanks for speedy+helpful response (from the Win32OLE father himself!!!)
---
require 'win32ole'
include WIN32OLE::VARIANT
MAX_DEPTH=5
MM=WIN32OLE.new("Mindmanager.Application")
MM.visible=true
def debug node
p [:node,node]
dispid=node.ole_method('getOffset').dispid
node._invoke(dispid, [0.0, 0.0], [VT_R4|VT_BYREF, VT_R4|VT_BYREF])
p [:offset,WIN32OLE::ARGV]
end
def randomMap node,label='Main',depth=5
node.text=label
depth.times do |index|
subnode=node.addSubtopic 'label'
debug subnode
randomMap subnode,'%s %02d' % [label,index+1],rand(depth)
end
end
node=MM.activeDocument.centralTopic
randomMap node
Produces:
c:\work>demo
[:node, #<WIN32OLE:0x2845008>]
[:offset, [30.0, -20.0]]
[:node, #<WIN32OLE:0x2844318>]
C:/Work/demo.rb:14:in `_invoke': _invoke (WIN32OLERuntimeError)
OLE error code:80040200 in MindManager.Application.6
Error: 'this topic is not able to execute the call'
HRESULT error code:0x80020009
Exception occurred from C:/Work/demo.rb:14:in `debug'
from C:/Work/demo.rb:22:in `randomMap'
from C:/Work/demo.rb:20:in `times'
from C:/Work/demo.rb:20:in `randomMap'
from C:/Work/demo.rb:23:in `randomMap'
from C:/Work/demo.rb:20:in `times'
from C:/Work/demo.rb:20:in `randomMap'
from C:/Work/demo.rb:28
> Hello,
>
> In message "Win32OLE output parameter access??"
> on 06/03/29, Dennis Misener <dm@accesscable.net> writes:
>
> > subnode.invoke('getOffset',0.0,0.0) # How to get this to work???
>
> Try
> include WIN32OLE::VARIANT
> ...
> dispid = subnode.ole_method('getOffset').dispid
> subnode._invoke(dispid, [0.0, 0.0], [VT_R4|VT_BYREF, VT_R4|VT_BYREF])
> or
> dispid = subnode.ole_method('getOffset').dispid
> subnode._invoke(dispid, [0.0, 0.0], [VT_R8|VT_BYREF, VT_R8|VT_BYREF])
>
> Regards,
> Masaki Suketa