Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: strange "if" problem

2 views
Skip to first unread message

Jean

unread,
Sep 11, 2006, 8:11:55 AM9/11/06
to
> So, sorry if I refer to a "long" code here:
>
>
> http://groups.google.com/group/microsoft.public.fr.scripting/msg/5749f70236e02971?dmode=source&hl=fr

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


James Truher

unread,
Sep 25, 2006, 7:53:22 PM9/25/06
to
one of the changes coming in RC2 is a change in single vs double quote
handling single quotes now really don't interpret characters, so `n is `n
not <CR>.

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...

Jean

unread,
Sep 26, 2006, 10:40:18 AM9/26/06
to
> one of the changes coming in RC2 is a change in single vs double quote
> handling single quotes now really don't interpret characters, so `n is `n
> not <CR>.
>

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

Jean

unread,
Sep 26, 2006, 12:53:29 PM9/26/06
to
> Also I note as a "best practice" to use single quote only if really necessary
> :-)

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")

Jean

unread,
Sep 26, 2006, 4:52:47 PM9/26/06
to
> Do they need double quotes too (I think "yes" but ...) with RC2 ?

Since RC2 is now out I'll can see that myself :-)

Jean

unread,
Oct 26, 2006, 4:57:51 PM10/26/06
to
> Updated script is soon/now available here :
> http://groups.google.com/groups?selm=mn.d3e17d699c60ab54.56820@windows

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.

0 new messages