Jump to content
Software FX Community
Sign in to follow this  
Ebgreen

New feature request (or maybe it is there and I just don't see it)

Recommended Posts

Ebgreen    0

Are there any plans to add forms type event handling to the gadgets? I know it is possible to have some drill down capability through recursion, but I'm thinking more along the lines of click and double-click event handling. So for instance if I have a gadget that shows the number of running processes on a dev server, then if I click the gadget, it would open a powershell window and run a command to list those processes. If I double click the gadget it would run a different PoSH script that cleans up some processes that are notorious for hanging and mass reproduction (*cough*...symantec report agent...*cough).

 

 

Of course it is entirely possible that this functionality is already there and I just haven't stumbled across it yet. If that is the case then any information to get me stumbling in the right direction would be great.

Share this post


Link to post
Share on other sites
marco.shaw    0

There isn't an option for single-click versus double-click, but a double-click/drilldown could open up a Windows form by simply calling a PowerShell script written to do so.  That being said, you might want to pass what was double-clicked on to the form somehow?

Give me a slightly more detailed example, considering what I've said above...

The resulting Windows form could have option buttons listed for you to do more specific tasks like you mention.

Share this post


Link to post
Share on other sites
Ebgreen    0

Actually what prompted this is the example that I have listed above. I have a digital panel that simply shows the number of processes that are running on a server: (gwmi win32_process -comp "XXXXXX").count. What I would like to be able to do is to click the panel and have it run a powershell script to list those processes: gwmi win32_process -comp "XXXXXX" | ft name

Share this post


Link to post
Share on other sites
Ebgreen    0

Ok, on a second read of the quickstart manual I see that I may be able to do what I want by using Multiple PowerShell Scripts (pg 27). The example given is for creating a gadget from the command line. I am using the creator instead and I do not see a way to add a -DrillDown_Script property in the creator.

Share this post


Link to post
Share on other sites
marco.shaw    0

Start with this:

1. Copy the attached test.pgf.txt file to your system in C:\, and rename to test.pgf.

2. Copy the start-monitor.ps1 script from here to C:\: http://thepowershellguy.com/blogs/posh/archive/2007/01/21/powershell-gui-scripblock-monitor-script.aspx. (I could attach it here if you have problems.)

Copy both to the same location, double-click test.pgf which should start a gadget, then try double-clicking the gadget itself.

This is a basic framework for what you've asked for.  Let me know what you think...

In the next 2 weeks, I'll try to create a guest blog post on this.  You don't have access to the drilldown features from Creator, but there's a copy and paste trick that can help out here.

[Edit: The original test.pgf puts the path and snap-ins as per my configuration.  Attached a new test.pgf referencing C:\ and removed the extra snap-ins I have loaded.]

Share this post


Link to post
Share on other sites
Ebgreen    0

Thanks. That is exactly what I was looking for. I am fine with doing the change in the pgf XML. Do you know if this functionality will be included in future versions of the creator?

Share this post


Link to post
Share on other sites
marco.shaw    0

The extra functionality you're asking about would be adding the drilldown via the Creator or a having a grid-type cmdlet available?  Or both?

(Feedback is always important!)

Share this post


Link to post
Share on other sites
valdezdj    0

Sorry but on second thought, how did you make the gadget clickable? I know you said that you would do a blog on this so if you are then I'll just wait for that.

Share this post


Link to post
Share on other sites
marco.shaw    0

Very nice! Is there anyway to change the location from C:\ to a certain folder? I don't keep all of my scripts in the C: folder.

Thanks,

D

You can change the folder: Open up the .pgf file in Notepad or another text editor, and edit these 2 lines to your liking with the full path:

...

<Data.CurrentLocation>FileSystem::C:</Data.CurrentLocation>

...

<Data.DrillDown.Script>C:\start-monitor.ps1 -s {gwmi win32_process -comp localhost}</Data.DrillDown.Script>

...

Share this post


Link to post
Share on other sites
Ebgreen    0

I'm pretty sure that simply adding the .DrillDown property makes it clickable. Or to be more precise, I think it is always clickable but adding the property gives it something to do when it is clicked.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×