mIRC Home    About    Download    Register    News    Help

Print Thread
#23317 09/05/03 03:03 AM
Joined: Feb 2003
Posts: 309
C
Fjord artisan
OP Offline
Fjord artisan
C
Joined: Feb 2003
Posts: 309
(repost of com! in scripts help)
Ahem, make this work if you can:
Below we have some VBscript which works fine under WSH:

set ie=createobject("InternetExplorer.Application")
ie.height = 175
ie.width = 300
ie.menubar = false
ie.toolbar = false
ie.statusbar = false
ie.resizable = false
ie.navigate "about:blank"
'Loop until IE is finished displaying the HTML
Do while ie.busy: x=x+1: loop
ie.document.body.innerHTML = "<html><body>BARK!</body></html">
ie.visible = true

Here's the mIRC port, as far as I can get:

alias ie {
comopen ie InternetExplorer.Application

set %ie ie
echo -s Opens InternetExplorer.Application for 180 seconds
echo -s set height: $com(%ie,height,4,int,175)
echo -s set width: $com(%ie,width,4,int,300)
echo -s set menubar: $com(%ie,menubar,4,bool,false)
echo -s set toolbar: $com(%ie,toolbar,4,bool,false)
echo -s set statusbar: $com(%ie,statusbar,4,bool,false)
echo -s set resizeable: $com(%ie,resizeable,4,bool,false)

;echo -s navigate: $com(%ie,navigate,1,bstr,about:blank)
echo -s navigate: $com(%ie,navigate,1,bstr,http://127.0.0.1/)
;This is what I have trouble with:
;echo -s set document.body.innerHTML: $com(%ie,document.body.innerHTML,5,bstr,test)

timer 1 10 echo -s set visible: $com(%ie,visible,4,bool,true)
timer 1 20 echo -s quit: $+($,com(%ie,quit,1))
timer 1 20 comclose %ie

}
How do we access properties/methods of nested objects, such as InternetExplorer.Application.document.body.innerHTML.

#23318 18/05/03 10:18 PM
Joined: May 2003
Posts: 9
J
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
J
Joined: May 2003
Posts: 9
I've been playing around with this for a bit and it doesn't seem possible.

According to help we should be able to retrieve a pointer to IDispatch using $com(ie,Document,3,dispatch*%doc) and then use $com(%doc,Body,3,dispatch*%body) and so on... to navigate the object heirarchy.

I made a simple VB COM object to test this. I have two classes Class1 and Class2. Class2 is a private member of Class1.

Class2 is very simple and has one property which returns a BSTR


Class1
===========
Private m_Class2 As Class2
Public Property Get Class2() As Class2
If m_Class2 Is Nothing Then
Set m_Class2 = New Class2
End If

Set Class2 = m_Class2
End Property
==========

Class2
==========
Public Property Get Val() As String
Val = "Hello"
End Property
==========

Now the script code:

alias ct {
comopen ct mIRCTest.Class1

echo -s Dispatch pointer: $com(ct).dispatch
echo -s Calling Class2: $com(ct,Class2,3,dispatch*%CL2)
echo -s Calling Val: $com(%CL2,Val,3)
echo -s Val is: $com(%CL2).result
comclose %CL2
comclose ct
}

It looks like %CL2 is never being created. Now what would be cool is a function that would act like the following

comopen Body $comGet(ct,Document.Body)

$comGet would parse the string and make the QI calls and build the objects for us. It would make this easy.

Until this is confirmed as a bug and fixed or a solution is found you could always write a really simple COM object in VB

Good luck

#23319 01/01/04 07:53 AM
Joined: Jan 2004
Posts: 1
J
Mostly harmless
Offline
Mostly harmless
J
Joined: Jan 2004
Posts: 1
As far as I can tell from reading the help file
$com(ie,document,3,dispatch*, doc)

that should create a variable doc however I can't get it to work

#23320 12/01/04 02:48 PM
Joined: Dec 2003
Posts: 219
F
Fjord artisan
Offline
Fjord artisan
F
Joined: Dec 2003
Posts: 219
That's it, the code is right.

Please read:

https://forums.mirc.com/showflat.php?Cat=...=true#Post69067

COM dispatch * is broken.


Link Copied to Clipboard