Jump to content
Software FX Community

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


Ebgreen

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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>

...

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.

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