I have a Powershell V2 script that is done and all dandy. I pass parameters to it via
myscript.ps1 -firstparameter Donald -secondparameter Duck
I would like to have a "kicker" or "launcher" window/gui that simply lets me pass the arguments. I've designed the GUI in PrimalForms but I can't figure out how to send the arguments to my script and launch it.
My questions are:
How would I start my script with my parameters from my PrimalForms GUI (or any other gui)?
Am I even on the right track here (having my script as a separate scriptfile) or shold I try to put my entire script inside the PrimalForms project?
Is PrimalForms the way to go with a task like this? (I've been hearing about WPF and I'm thinking with the upcoming release of PS3 and all..)
PS: As of now I do not need any interaction with the GUI after "OK" have been pressed. I have no problem seeing a Powershell window pop up and do all the work in its "ugly glory"..
All help/tips are GREATLY appreciated:)
So in PrimalForms i'm imagining you create a few user input controls (textboxes, etc) and you have a button to click to launch your script with the parameters the user entered into your form input controls. If this is the case you would create an event handler for the button and add the code to call your script to the script block handler. If you are using the free community edition, on the right you will see at the top of the properties pane a lightning bolt icon. This will add the code templates linking scriptblocks to the various GUI events. Click on your button and find the OnClick event and double click in the text field to add the code template. When you copy the generated code you will see a script block created for your button. You can launch your script from there. You'll need to access the forms properties to get the data the user entered. Something like & .\MyScript -Param1 $form1.textbox1.text -Param2 $form1.textbox2.text.
Related
I've got a pretty complex question for any Maya coders...
I want to utilize a drop down menu similar to that of the cmdScrollFieldExecuter's [script editor's] "Show Tooltip Help". It looks like a window that has been appended to the bottom of the inputted text with a feedback of all relative commands or strings.
Does anyone have experience with appending a similar textbox/ window/ menu to typed input, and if so, can you toss me in the right direction?
Note: I am not talking about "optionMenu".
Alternatively, is there a way to get cmdScrollFieldExecuter to reference a different array or set of strings?
A complete port of that won't be possible in vanilla Maya - You'd need to use python and QT because the built-in GUI objects (such as TextField) don't fire any events on keypresses so you won't be able to live-update as the user types.
You can almost fake the visual appearance with a window whose title bar is set to off. Use a formLayout to dock a TextScrollField inside it. You'll need to hack up some way of dismissing it since it won't have a close box -- you could put it on a timer or add an invisible button covering the whole thing which closed the window when clicked
I am trying to create two user controls in Silverlight using the Windows Phone SDK 7.1. I would like to be able to drag from one control and drop into the other control (or at least receive the event that the drop has occurred).
I am able to give the appearance that the drag is moving the item by using a TranslateTransform. However, I would be interested in knowing whether this can be done by actually moving the element instead of transforming it. Can this be done?
Second, and probably more importantly, how do I get the second control to see the drop event? I've done lots of reading, and no luck with this so far.
FWIW, I am currently using a Grid in each control, but I would be open to changing to a Canvas or other control type.
I am not much aware of windows phone, but we can drag an object from one controller to another controller.(What i did in iOS)
Steps to be followed:
Both controllers should be in same window.
On ManipulationStarted(touches begin) drag the object or item from one controller, Move on another controller
On ManipulationEnded(touches ended) check the dragged object is within the second controller. if Yes, add the object to second controller.
I hope my answer helped you. If it's not useful sorry for that.
I am working on a WinForm Application.
The Form has many fields/components but is poorly built.
for example a field is used as user name on one case and used as folder path on the other case. Code is quite poorly maintaned.
Is is possible that when i run the application and GUI appears, i can use a tool like 'spy++' which can show me 'names' of the components (not ids). For instance the name of a button or name of a label.
Or if i can use SPY++ for 'names' please tell me?
I would solve the problem by adding a ToolTip control to your form and iterating over each control and adding a Tool Tip message to each control that is the name of the control.
First, add a ToolTip object to your form (from the Tools section of the designer.) You can rename it, but for the sake of my demo, I left it as the default name toolTip1.
Next, add a method similar to the one I'm posting below to the code page of your form. (I'm assuming this is for C# but the code is simple and can easily be modified for VB or C++).
public void AddNameToToolTip(Control c)
{
toolTip1.SetToolTip(c, c.Name);
foreach (Control child in c.Controls) AddNameToToolTip(child);
}
Finally, from within the Form constructor, add the following line of code after the call to InitializeComponent().
AddNameToToolTip(this);
This will add a ToolTip message to each control in your form. All you should have to do is hover your mouse over each control and the ToolTip will pop up a message after a second or two displaying the name of the underlying control.
Alternatively, you can recursively adding a MouseHover event to each control and when the event is fired, write the name of the control to the debugger. This would also work if you are already using a ToolTip control within your form.
On Windows XP, it was possible to disable the Start button with the following code:
hTray = FindWindow (TEXT("Shell_TrayWnd"), NULL);
if (hTray)
{
hStartButton = FindWindowEx(hTray, NULL, TEXT("Button"), NULL);
if (hStartButton) ShowWindow(hStartButton, FALSE);
}
For a public-access computer configuration, I need to be able to do this on Windows 7. The Start button must be disabled (not just hidden), and the remainder of the Taskbar must still be visible and usable. Hiding the Taskbar along with the Start button is not an option. Running full-screen is not an option. Using "Start Killer" won't work because it doesn't actually disable the Start button, just hides it (users can still use hotkeys to pull up the Start menu).
I have already tried the method that uses FindWindowEx with 0xC017 as its third parameter and then tries to disable that window. It doesn't work. That method only works if the whole Taskbar is disabled first. What I need is a method that only disables the Start menu, just like the code I reproduced above does in XP.
Any help is greatly appreciated.
The "correct" version for Windows 7 is as shown below:
HWND hStartBtn = FindWindowEx(NULL, NULL, MAKEINTATOM(0xC017), TEXT("Start"));
if (hStartBtn != NULL)
{
ShowWindow(hStartBtn, FALSE);
}
However, this only disables the button, meaning you won't get the glow or other effects by hovering your mouse cursor over it. You can still click the button region on the taskbar to open the menu. Apparently, the click handler is now implemented in the taskbar window itself, not as part of the separate Start button. That's why you have to disable the entire taskbar first, and consequently why most of the solutions you've found online do precisely that.
However, it looks like the "Start Killer" application now has functions to disable the most common hotkeys that trigger the Start menu, namely Ctrl+Esc and the key. You'll find those options by launching the software, right-clicking on its icon in the taskbar, and selecting "Options" from the menu. You can also edit the Registry to disable the Windows key, as described in this knowledge base article. If you wanted to implement this same functionality yourself through code, the only solution would be a low-level keyboard hook that trapped the keypress events that are responsible and discarded them.
Undocumented hacks like this one are given to breaking with newer versions of Windows. I imagine that Raymond Chen would chuckle and say something like "I told you so". Hacking the Windows interface is a fool's errand. Or, as you say several times in the question, "is not an option".
IS there anything in particular about the start menu you need to disable? You may be able to do the same via policy settings or various other file permissions.
Use one of the available group policies listed here.
You did not mention why you want to disable the start button. If you think about what exactly it is that you don't want your users to do instead of telling us the solution you picked for it (i.e., "disable the start button"), you might come up with a much better solution.
For example, if you want to prevent users from changing certain settings, block that, not the start button!
Or if you don't want them to see all the installed apps, hide those apps instead of the start button!
Or...
(I hope you see my point here).
I am working on a windows form app like most development it is usually useful to see output. I am wondering what methods you use to see output in a windows form app.
PS. I am new to visual studio in general.
You can set some Labels around and display text on them:
Label.Text = "Some Text";
And DataGridView controls for information from tables, and for a better insight, you can set breakpoints in your code by clicking the far-left part of your code editing area. When the program reaches to that point it'll stop and you can hover your variables and objects for a better view of their insides...
Oh, and also VS has a "Locals" window when you run your project, that shows all the objects and variables being used and some information about them.
the user interface (a grid or other
controls on a form)
a report (like Crystal)
a file (.txt)
a database table updated