This blog has moved to http://ThePowerShellGuy.com
Greetings /\/\o\/\/
A small word checker for MSH using MSN Search,
it uses the Culture of the MSH Shell, but you can overrule it.
it works like this :
MSH>check-spelling januar
january
MSH>check-spelling januar nl-nl
januari
MSH>
the script looks like this :
# Check-Spelling
# checks spelling of a word using MSN Search Web Service
# /\/\o\/\/ 2006
# http://mow001.blogspot.com
Function Check-Spelling {
param([string]$word,
[string]$Culture = (get-Culture).name
)
$MSN = new MSNSearchService
$s = new SourceRequest
$s.source = [sourcetype]::spelling
$s.ResultFields = ([ResultFieldMask]::All)
$sr = new SearchRequest
$sr.AppID = "Your AppID here !!!!!"
$sr.Requests = $S
$sr.Flags = [SearchFlags]::None
$sr.CultureInfo = $Culture
$sr.query = $word
$r = new sourceResponse
$r = $MSN.Search($sr)
$r.responses[0].results | foreach {$_.Title}
}
(for getting the DLL and AppID Needed see,
Search with MSN Search Web API from MSH (Part 1)) gr /\/\o\/\/
Tags : Monad mshPS I'm also working on extending the search example of the 2nd part of this series,
for now 2 quick fixes I did I thinks are handy :
# fixes on example part 2
# Overrule the Prompt to show result Count (I did rename prompt-continue) :
$Choice = Prompt-Choice -caption "Showing : $($S.Offset) to $($S.Offset + 9) of $($r.Responses[0].total) Results"
# Fix for opening explorer on empty URL
[0-9] {
if ($r.responses[0].results[($_)].url) {
(new-object -com shell.application).ShellExecute($r.responses[0].results[($_)].url)
}
}