After
doing these posts:
I concluded
that many people won’t want to download the full NetApp TR set (from 4000), and
instead might just want links directly to the TR, so I did the previous post:
The HTML
code of the previous post, was completely generated by code, and below is the
PowerShell (which is mostly taken from the Collector Script). I don’t think
this is useful to anyone but myself, still, it’s good to share. I’ve used a
picture file (PNG) for the final bit of code (the interesting bit), since Blogger Compose doesn’t
format HTML code.
############################
## NetAppTR_Links_Creator ##
############################
Param(
[Int]$RangeStart = 4000,
[Int]$RangeEnd = 4700,
[String]$OutputFile =
"TR_HTML_links.txt"
)
[String]$CatalogDL =
"http://www.cosonok.com/2017/07/netapp-technical-reports-catalogue.html"
# Generic display function:
Function
Wr{Param($P,$I="WHITE");Write-Host $P -ForegroundColor $I}
##########################
## TITLE EXTRACTER CODE ##
##########################
## Acquire the NetApp TR
Catolog if not already acquired
If($Global:NaTrCatalog){}
Else{
Try{$Global:NaTrCatalog = Invoke-Webrequest
$CatalogDL -Method Get}
Catch{
Wr "FAILED: Unable to acquire
catalog!" YELLOW
}
}
## Some variables:
If($Global:NaTrCatalog){
[System.Array]$Arr =
($Global:NaTrCatalog).Content.Split("`n")
$Catalog = ($Global:NaTrCatalog).Content
$Count = $Arr.Count
}
$Position = 0
Function Get-Title{
If($Catalog.Contains("TR-$($j):")){}
Else{RETURN ""}
For($k=$Position;$k -lt $Count;$k++){
If($Arr[$k].Contains("TR-$($j):")){
$Position++
[String]$Title =
$Arr[$k].Split(">")[1]
$l=1
While($TRUE){
If($Title.Contains("<")){
$Title = $Title.Split("<")[0]
RETURN $Title
}else{
$Title += " "
$Title += $Arr[$k+$l]
}
$l++
If(($k+$l) -ge $Count){
Wr "FAILED: Something went wrong
here!" RED;PAUSE;EXIT
}
}
}
}
}
Image: HTML Links Creator Section
Comments
Post a Comment