Page 1 of 1

Question about Variables with Trial Version

Posted: Sun Nov 22, 2015 6:43 am
by millertime
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?

Re: Question about Variables with Trial Version

Posted: Sun Nov 22, 2015 7:18 am
by jvierra
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/

Re: Question about Variables with Trial Version

Posted: Sun Nov 22, 2015 7:20 am
by jvierra
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

Re: Question about Variables with Trial Version

Posted: Sun Nov 22, 2015 10:24 am
by millertime
$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={

}

Re: Question about Variables with Trial Version

Posted: Sun Nov 22, 2015 12:34 pm
by jvierra
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.