Jump to content
Software FX Community

Question about refresh


kmihalic

Recommended Posts

Posted

Hi,

 I have tied to create function which will return single number and pipe output to gauge (digital).

For example:

function rr {  $rdm  = new-object random  $rdm.next(100) }

if I call function it will return random number, but when I tried  $rr | out-gauge -type digital -refresh 0:0:1refresh would not work, only one number is displayed.Is this supported?

Krunoslav

Posted

Refreshing is a very interesting feature in PowerGadgets. Hopefully we will make some time to blog about this in the not so distant future.

The problem is that in order to support refresh we have to obviously reexecute the command that generated the data, the first tricky scenario is variables. We do support the following (if you are running a very old build it may not work)

$a = "W*"ps $a | out-chart -refresh 0:0:5

Now run wordpad and check that the chart is refreshed with wordpad's process info. There are some subtleties on what type of variables we support but in the simple case it will just work.

In your case - using functions - we are not able to push that function definition across so your gauge will not be refreshed. The only easy solution at this point is to move the body of the rr function to a PS1 file (e.g MyRandom.ps1) and then execute .\MyRandom.ps1 | out-gauge. In this case when we reexecute we ask powershell to reexecute MyRandom.ps1 and it should work as expected.

Hope this helps

JuanC

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...