Jump to content
Software FX Community

Question about refresh


Recommended Posts


 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?


Link to comment
Share on other sites

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


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...