header
header Register : : Login header
header
divider
menuleft
menuright
submenu
left

[August 25th, 2008] Check the home page regarding PowerShell related news from a brand new sponsor: Idera

What's the trick to use {code} {/code}
Last Post 29 Feb 2008 09:57 PM by DonJ. 11 Replies.
Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
kscrissUser is Offline
Basic Member
Basic Member
Posts:119

--
05 Feb 2008 09:13 PM  

Even when I use the less than and greater than signs is does not format the script correctly for me.

My blog: http://blogs.powershellcentral.com/kscriss/
DonJUser is Offline
PowerShell MVP
Basic Member
Basic Member
Posts:134
Avatar

--
08 Feb 2008 05:15 PM  
If Code Then

Depends on the language you're looking to have it format.
- Don Jones
www.ConcentratedTech.com
Subscribe (RSS) or visit for weekly PowerShell tips and lessons
DonJUser is Offline
PowerShell MVP
Basic Member
Basic Member
Posts:134
Avatar

--
08 Feb 2008 05:15 PM  
http://www.activemodules.com/Community/tabid/55/forumid/115/tpage/1/view/topic/postid/40876/Default.aspx#40876
- Don Jones
www.ConcentratedTech.com
Subscribe (RSS) or visit for weekly PowerShell tips and lessons
kscrissUser is Offline
Basic Member
Basic Member
Posts:119

--
11 Feb 2008 06:00 PM  

function ConvertIIS-LogFile
{
param( )
begin { }
process
{
$file = [System.IO.File]::openText( $_.fullname )
while($line = $file.ReadLine())
{ if(!$line.StartsWith('#') -and ($line.Length -gt 19))
{ $UTCdatestring = $line.Substring(0, 19)
$WorkDate = Get-Date($UTCdatestring)
$LocalWorkDate = $WorkDate.tolocaltime()
$FormatLocalWorkDate = $LocalWorkDate.ToString("yyyy-MM-dd HH:mm:ss")
$StringLength = $line.length
$RestOfString = $line.substring(19,$StringLength - 19)
# $RestOfString | Out-Host
$OutString = "$FormatLocalWorkDate"+"$RestOfString"
Write-Output $OutString
}
ElseIF ($line.contains("Date:"))
{
$UTCdatestring = $line.Substring(7, 19)
$WorkDate = Get-Date($UTCdatestring)
$LocalWorkDate = $WorkDate.tolocaltime()
$FormatLocalWorkDate = $LocalWorkDate.ToString("yyyy-MM-dd HH:mm:ss")
$BeginString = $line.substring(0,6)
$StringLength = $line.length
$RestOfString = $line.substring(7+19,$StringLength - 19 -7)
# $RestOfString | Out-Host
$OutString = "$BeginString"+"$FormatLocalWorkDate"+"$RestOfString"
Write-Output $OutString
}
Else
{
Write-Output $line
}
}
}
End {}
}
My blog: http://blogs.powershellcentral.com/kscriss/
kscrissUser is Offline
Basic Member
Basic Member
Posts:119

--
11 Feb 2008 06:01 PM  
I still don't get it.
My blog: http://blogs.powershellcentral.com/kscriss/
kscrissUser is Offline
Basic Member
Basic Member
Posts:119

--
11 Feb 2008 06:09 PM  

Public Sub HelloWorld()
Response.Write("Hello World")
End Sub

My blog: http://blogs.powershellcentral.com/kscriss/
kscrissUser is Offline
Basic Member
Basic Member
Posts:119

--
13 Feb 2008 04:55 PM  
O.K. This is another test. I am using the script HightLight-Syntax.ps1 from the script vault. I am calling the script in this way.

./HightLight-Syntax.ps1 ./HighLight-Syntax.ps1 > out.htm

I am using the script to HightLight itself and am sending the output to out.htm. Now I will attemp to cut and past a code snipped from this output into this post.

Highlight-Syntax.ps1
# version 1.0
# by Jeff Hillman
#
# this script uses regular expressions to highlight PowerShell
# syntax with HTML.

param( [string] $code, [switch] $LineNumbers )
# $LineNumbers=$True
"$code = Code variable"| Out-Host
"$LineNumbers = LineNumbers variable " | Out-Host
if ( Test-Path $code -ErrorAction SilentlyContinue )
{
$code = Get-Content $code | Out-String
}

$backgroundColor = "#DDDDDD"
$foregroundColor = "#000000"
$stringColor = "#800000"
$commentColor = "#008000"
$operatorColor = "#C86400"
$numberColor = "#800000"
$keywordColor = "#C86400"
$typeColor = "#404040"
$variableColor = "#000080"
$cmdletColor = "#C86400"
$lineNumberColor = "#404040"

filter Html-Encode( [switch] $Regex )
{
# some regular expressions operate on strings that have already
# been through this filter, so the patterns need to be updated
# to look for the encoded characters instead of the literal ones.
# we do it with this filter instead of directly in the regular
# expression so the expressions can be a bit more
My blog: http://blogs.powershellcentral.com/kscriss/
kscrissUser is Offline
Basic Member
Basic Member
Posts:119

--
13 Feb 2008 04:56 PM  
That did work using the "QUICK REPLY". I'll try a new forum post next: i.e. not using the "Quick Reply".
My blog: http://blogs.powershellcentral.com/kscriss/
kscrissUser is Offline
Basic Member
Basic Member
Posts:119

--
13 Feb 2008 04:56 PM  
That did work using the "QUICK REPLY". I'll try a new forum post next: i.e. not using the "Quick Reply".
My blog: http://blogs.powershellcentral.com/kscriss/
DonJonesUser is Offline
New Member
New Member
Posts:2
Avatar

--
13 Feb 2008 06:50 PM  
I'm not certain what the expectation is. The CODE tags aren't designed to color-code PowerShell script, if that's what you're after. They're primarily designed to provide a mononspaced font in a scrollable region - the forums software doesn't provide syntax highlighting for PowerShell (which is tough to do since PowerShell is a dynamic language of sorts).
kscrissUser is Offline
Basic Member
Basic Member
Posts:119

--
13 Feb 2008 07:19 PM  
How do I take the STARS 5-Stars off this post? I was playing with the STARS and now I can't take them off? Do you think I put them on but touching the star feature near the "Add Reply" button?

Am I the only one that sees these stars, by this I mean are the stars just for me or all to see?
My blog: http://blogs.powershellcentral.com/kscriss/
DonJUser is Offline
PowerShell MVP
Basic Member
Basic Member
Posts:134
Avatar

--
29 Feb 2008 09:57 PM  
The stars are part of the rating system. They don't come off - wouldn't be fair for someone to be able to remove a bad rating :).
- Don Jones
www.ConcentratedTech.com
Subscribe (RSS) or visit for weekly PowerShell tips and lessons
You are not authorized to post a reply.

Active Forums 4.1
right
   
footer Sponsored by Quest Software • SAPIEN Technologies • ShellTools, LLC • Microsoft Windows Server 2008 footer
footer