Question about Variables with Trial Version

Ask your Windows PowerShell-related questions, including questions on cmdlet development!
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Locked
User avatar
millertime
Posts: 3
Joined: Fri Sep 06, 2013 2:28 pm

Question about Variables with Trial Version

Post by millertime » Sun Nov 22, 2015 6:43 am

Hello,

I am writing a proof of concept app for my manager to attempt to get a license.

My variables are
$Path = C:\Users\UserID\Desktop
$FolderName = $Folder

The form has 1 text input box (design name = $folder) where the user would type in a folder name. From the text inputbox (design name = $Folder) it would make a folder in C:\users\loginid\desktop\(textbox folder name).

It does not seam to be passing the $path or the $foldername when I click the button with the command
New-Item $Path $Foldername - directory.

Is there something I am missing here?

User avatar
jvierra
Posts: 13717
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: Question about Variables with Trial Version

Post by jvierra » Sun Nov 22, 2015 7:18 am

It is not really possible to understand what you are asking. If you post an example of your script maybe it will be clearer.
You can also learn how to design forms by reading these blog articles:

https://www.sapien.com/blog/topics/user ... istrators/

User avatar
jvierra
Posts: 13717
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: Question about Variables with Trial Version

Post by jvierra » Sun Nov 22, 2015 7:20 am

millertime wrote: It does not seam to be passing the $path or the $foldername when I click the button with the command
New-Item $Path $Foldername - directory.
Assume a textbox called $testbox1. To obtain the contents you would use $textbox1.Text

User avatar
millertime
Posts: 3
Joined: Fri Sep 06, 2013 2:28 pm

Re: Question about Variables with Trial Version

Post by millertime » Sun Nov 22, 2015 10:24 am

$form1_Load={
#TODO: Initialize Form Controls here
$folder = C:\Users\user\Desktop
$foldername = $textbox1_TextChanged

}

$button1_Click={

New-Item -ItemType directory -Path $F

}

$textbox1_TextChanged={

}

User avatar
jvierra
Posts: 13717
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: Question about Variables with Trial Version

Post by jvierra » Sun Nov 22, 2015 12:34 pm

Start by reading the contents of the link I posted. You need to learn how a form works. There are numerous examples and a good explanation of how to use forms and controls with PowerShell. If you have no experience with PowerShell or any programming background then this will take a bit of time to learn. GO slow and learn the parts. The rest will come slowly.

Note that variables in PowerShell have "scope" sart by looking this up: https://technet.microsoft.com/en-us/lib ... 47849.aspx

PowerShell studio also has many examples and the documentation will help you to learn how to use it.

Locked