Search found 11727 matches

by jvierra
Fri Jan 19, 2018 8:53 am
Forum: PowerShell GUIs
Topic: Newbie form questions
Replies: 13
Views: 180

Re: Newbie form questions

Here is the best way to pass parameters into a form that will be packaged. Param ( $p1, $p2 ) $form1_Load={ $label1.Text = $p1 $label2.Text = $p2 } This can be called: PS D:\scripts> D:\TEST\bin\x64\NamedParams.exe -p1 test1 -p2 test2 PS D:\scripts> D:\TEST\bin\x64\NamedParams.exe test1 test2 The "e...
by jvierra
Fri Jan 19, 2018 8:36 am
Forum: PowerShell GUIs
Topic: Newbie form questions
Replies: 13
Views: 180

Re: Newbie form questions

Cody - you don't have to zip PSF files. Just attach them which makes downloading much easier.
by jvierra
Fri Jan 19, 2018 8:32 am
Forum: PowerShell GUIs
Topic: Switch statement
Replies: 11
Views: 113

Re: Switch statement

Load the CSV globally. Place it outside of any event or function.

You should put the header in the CSV file. You don't need to specify the delimiter if it is a comma.

You can also do this in the "Load" event:

$global:csv = Import-Csv '\\remotepath\Get-AppsModelSwitch.csv'
by jvierra
Fri Jan 19, 2018 7:27 am
Forum: PowerShell GUIs
Topic: Switch statement
Replies: 11
Views: 113

Re: Switch statement

You can easily use a combobox as a label.

You can also just filter the CSV:

$label.Text = ($csv | Where{$_.Column1 -eq 'somevalue'}).Column2
by jvierra
Fri Jan 19, 2018 6:54 am
Forum: PowerShell GUIs
Topic: Switch statement
Replies: 11
Views: 113

Re: Switch statement

We would not use a switch statement. Use a ComboBox or ListBox loaded from a CSV file. A ComboBox will set itself according too the value it is bound to.
by jvierra
Fri Jan 19, 2018 5:26 am
Forum: PowerShell GUIs
Topic: Switch statement
Replies: 11
Views: 113

Re: Switch statement

What is your question or are you just discussing what you would like to do?
by jvierra
Thu Jan 18, 2018 5:13 pm
Forum: PowerShell GUIs
Topic: Newbie form questions
Replies: 13
Views: 180

Re: Newbie form questions

Add the "param statement to the form at the top. After you build the exe this will accept your parameters. To understand how to use PowerShell and the "Param" statement see: https://www.sapien.com/forums/viewtopic.php?f=21&t=6451 For specifics on "Param" see: https://www.sapien.com/forums/viewtopic....
by jvierra
Thu Jan 18, 2018 3:57 pm
Forum: PowerShell GUIs
Topic: Newbie form questions
Replies: 13
Views: 180

Re: Newbie form questions

Command line parameters in PowerShell are retrieved via a "Param" statement or via the built-in $args variable.

http://www.itprotoday.com/management-mo ... ell-params
by jvierra
Thu Jan 18, 2018 3:11 pm
Forum: PowerShell GUIs
Topic: Newbie form questions
Replies: 13
Views: 180

Re: Newbie form questions

Cody has shown a brute force method but there are other ways to do this. Cody's method removes everything. The individual buttons can be removed and the form frame type can also be changed to accomplish this. You can also just create the original form by creating a "Dialog Form" from the templates l...