Question about Variables with Trial Version

Ask your 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.
This topic is 8 years and 4 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
millertime
Posts: 3
Last visit: Fri Dec 14, 2018 3:29 pm

Question about Variables with Trial Version

Post 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?
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Question about Variables with Trial Version

Post 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/
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Question about Variables with Trial Version

Post 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
User avatar
millertime
Posts: 3
Last visit: Fri Dec 14, 2018 3:29 pm

Re: Question about Variables with Trial Version

Post 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={

}
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Question about Variables with Trial Version

Post 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.
This topic is 8 years and 4 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked