Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > PowerShell

How Powershell parse HTMLDocument?

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 09-27-2007   #1 (permalink)
william.wang
Guest


 

How Powershell parse HTMLDocument?

$htmlDoc= New-Object -com "HTMLFILE"
$page = "<html><body>this is a test</body></html>"
$htmlDoc.write($page)
$htmlDoc.close

but get Type mismatch exception message in
code line : $htmlDoc.write($page)

how to avoid this?

thanks


My System SpecsSystem Spec
Old 09-27-2007   #2 (permalink)
william.wang
Guest


 

Re: How Powershell parse HTMLDocument?

same time VbScript code can work:
vbscript code:


set htmlDoc= createobject("HTMLFILE")
page = "<html><body>this is a test</body></html>"
htmlDoc.write(page)
htmlDoc.close


My System SpecsSystem Spec
Old 10-07-2007   #3 (permalink)
william.wang
Guest


 

Re: How Powershell parse HTMLDocument?

On Sep 27, 2:35 pm, "william.w...@xxxxxx" <william.w...@xxxxxx>
wrote:
Quote:

> $htmlDoc= New-Object -com "HTMLFILE"
> $page = "<html><body>this is a test</body></html>"
> $htmlDoc.write($page)
> $htmlDoc.close
>
> but get Type mismatch exception message in
> code line : $htmlDoc.write($page)
>
> how to avoid this?
>
> thanks
I get the answer.
use $htmlDoc |get-member to debug the object method,find a
IHTMLDocument2_write method
so change the code :
$htmlDoc.write($page) to > $htmlDoc.IHTMLDocument2_write($page)

the code could work


My System SpecsSystem Spec
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
MSXML 4.0 SP2 Parse and SDK t-4-2 Vista performance & maintenance 0 07-10-2008 12:29 PM
Can Powershell parse email? akcorr PowerShell 4 03-26-2008 01:43 PM
Parse XML files from Powershell? Duncan Smith PowerShell 8 03-21-2007 07:31 AM
Using Parse-TextObject J.Marsch PowerShell 6 01-19-2007 08:20 AM
Parse hyperlinks Jan Kucera Avalon 4 11-27-2006 07:56 AM


Update your Vista Drivers Update Your Drivers Now!!

Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008