Ebgreen Posted August 27, 2007 Report Share Posted August 27, 2007 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. Quote Link to comment Share on other sites More sharing options...
marco.shaw Posted August 27, 2007 Report Share Posted August 27, 2007 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. Quote Link to comment Share on other sites More sharing options...
Ebgreen Posted August 27, 2007 Author Report Share Posted August 27, 2007 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 Quote Link to comment Share on other sites More sharing options...
Ebgreen Posted August 27, 2007 Author Report Share Posted August 27, 2007 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. Quote Link to comment Share on other sites More sharing options...
marco.shaw Posted August 27, 2007 Report Share Posted August 27, 2007 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.] Quote Link to comment Share on other sites More sharing options...
Ebgreen Posted August 28, 2007 Author Report Share Posted August 28, 2007 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? Quote Link to comment Share on other sites More sharing options...
marco.shaw Posted August 28, 2007 Report Share Posted August 28, 2007 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!) Quote Link to comment Share on other sites More sharing options...
Ebgreen Posted August 28, 2007 Author Report Share Posted August 28, 2007 Adding the drilldown specifically although the grid is nice while I'm feeling greedy. [] Quote Link to comment Share on other sites More sharing options...
valdezdj Posted August 30, 2007 Report Share Posted August 30, 2007 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 Quote Link to comment Share on other sites More sharing options...
valdezdj Posted August 30, 2007 Report Share Posted August 30, 2007 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. Quote Link to comment Share on other sites More sharing options...
marco.shaw Posted August 30, 2007 Report Share Posted August 30, 2007 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> ... Quote Link to comment Share on other sites More sharing options...
Ebgreen Posted August 30, 2007 Author Report Share Posted August 30, 2007 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. Quote Link to comment Share on other sites More sharing options...
valdezdj Posted August 30, 2007 Report Share Posted August 30, 2007 Got it! Thanks guys. Can you say 'Duh'? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.