Page 1 of 1 1
Topic Options
#86209 - 2002-06-20 11:41 PM Help with IE and com objects
Anonymous
Unregistered


Hello all,

Based on all of your posts, in this awesome bullentin board, I am able to pull back HTML from a page using COM in my Kixtart script. I do have one issue that I need help with. The page that I am pulling from is framed so naturally the html that I retreive is from the wrong frame. How does one specify which frame to retreive from? Thanks.. Here is the code:

code:
  
$ie=CreateObject("InternetExplorer.Application")
$ie.visible=1
$ie.navigate("http://www.myserver.com/")
While $ie.busy AND $ie.readystate <> 4 AND @error = 0
Sleep(1) "."
Loop
$doc = $ie.document
$data = $doc.documentelement.innerHTML

? $data

Beach

Top
#86210 - 2002-06-21 01:14 AM Re: Help with IE and com objects
cj Offline
MM club member
*****

Registered: 2000-04-06
Posts: 1102
Loc: Brisbane, Australia
Have a look at Microsoft's DHTML reference. There is a collection under the Window object called Frames.

hth

cj

Top
#86211 - 2002-06-21 02:24 AM Re: Help with IE and com objects
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Life's a Beach, eh Beach ?

Here's a quicky example thats pulls a frame from the Kixtart Helpdesk ... it grabs the menu pane on the left side ... might try changing the parms at top of script to suite your instance ... hope this helps !

break on

$URL = "http://helpdesk.kixtart.org/"
$FRAME = "menu"
$OUTPUT = "html.txt"

$ie = createobject("internetexplorer.application")

$ie.visible=0

$ie.navigate($URL)

while $ie.busy and $ie.readystate <> 4 and @error = 0 sleep(1) loop

$html = $ie.document.frames($FRAME).document.documentelement.innerhtml

if open(1,$OUTPUT,5) = 0
 $=writeline(1,$html)
 $=close(1)
endif

$ie.quit
$ie = 0


Luck ...

-Shawn

[ 21 June 2002, 02:55: Message edited by: Shawn ]

Top
#86212 - 2002-06-21 03:07 AM Re: Help with IE and com objects
Anonymous
Unregistered


Thats the stuff!! Thanks man, I was going crazy looking for info at the MSDN site.

I changed the 'innerhtml' to 'innerText' and got back exactly what I needed.

Thanks again!

Beach

Top
Page 1 of 1 1


Moderator:  Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 884 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.201 seconds in which 0.159 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org