5/22/2011

PowerShell is cool – how many images in a Word document.

 

Problem: How many screen captures do I have in my new book? (Just curious you know…)

The Answer… PowerShell!

A quick Bing and I found this:

http://blogs.technet.com/b/heyscriptingguy/archive/2008/11/13/how-can-i-count-how-many-images-are-embedded-in-microsoft-word-documents.aspx

 

As I only need to check one file, I shortened the code to just this:

image

 

So now I know… I’ve created over 300 screen captures for the new SharePoint® 2007 and 2010 Customization for the Site Owner book.

 

.

1 comment:

Mike Smith said...

$file = "" #full path

function WordStats ($file)
{
$word = New-Object -ComObject word.application
$word.Visible = $false
$doc = $word.Documents.Open($file)

"InlineShapes: " + $doc.InlineShapes.Count
"Paragraphs: " + $doc.Paragraphs.Count
"Words: " + $doc.Words.count
"Characters: " + $doc.Characters.Count

$doc.Close()
$word.Quit()
}

Note to spammers!

Spammers, don't waste your time... all posts are moderated. If your comment includes unrelated links, is advertising, or just pure spam, it will never be seen.