An improved version of the script is now available here :
http://groups.google.com/group/microsoft.public.fr.scripting/msg/112cabd0e318dc9a?hl=fr
° parameter $strdate is renamed $vardate
° parameter $fullyear is removed.
To get a full year calendar just pass year as integer :
.\gadget-calendar 27
returns full year 27
.\gadget-calendar 2011
returns full year 2011
° a problem with 1st century years (1..99) fixed
Note :
Jacques Barathon reports me a bad rendering with a *post* RC1 version :
blank lines added between day's numbers rows.
This is not yet fixed .
Regards,
--
Jean - JMST
Belgium
In line 102 you have
$table[$table.Length-1]+= '`n'
change this to double quotes:
$table[$table.Length-1]+="`n"
and it works as expected
--
--
James Truher [MSFT]
Windows PowerShell Development
Microsoft Corporation
This posting is provided "AS IS" with no warranties, and confers no rights.
"Jean" <repo...@groupe.svp> wrote in message
news:mn.5b537d695bd3d86d.56820@windows...
This change is good to know :-)
> In line 102 you have
>
> $table[$table.Length-1]+= '`n'
> change this to double quotes:
> $table[$table.Length-1]+="`n"
>
As the single quote's "don't interpret escape char and variables"
behavior isn't needed in this script I've replaced all single quotes
with double quotes.
Also I note as a "best practice" to use single quote only if really
necessary :-)
> and it works as expected
Great thanks James.
Updated script is soon/now available here :
http://groups.google.com/groups?selm=mn.d3e17d699c60ab54.56820@windows
This could seem a detail but ...
I'm not sure to do a good choice here.
As using single quote, variables and escape parser aren't used (so I
suppose) can we consider the use of single quote faster than double
quote ?
If yes I prefer to give "priority" to single quote.
In this case, they are two lines in script using :
.Split('`n')
Do they need double quotes too (I think "yes" but ...) with RC2 ?
.Split("`n")
Since RC2 is now out I'll can see that myself :-)
Since I've written this script I've seen that [console] has a
ResetColor method working well.
So instead the use of :
...
$rui=(get-host).UI.RawUI
## Stores current background/foreground console's colors ##
$oldfg=$rui.ForegroundColor
$oldbg=$rui.BackgroundColor
...
## Restores console's background/foreground colors ##
$rui.ForegroundColor=$oldfg
$rui.BackgroundColor=$oldbg
we can simply set colors by using $rui. or [console]:: and just place :
[console]::ResetColor()
at the end of the script.