I'm having trouble wrapping my head around the responsive forms with the examples from the articles below. Does anyone have a simple form that copies files or something they could share using this method. I really think I just need to see an example of a working script that I can dissect.
https://www.sapien.com/blog/2011/07/15/primalforms-2011-creating-responsive-loops
https://info.sapien.com/index.php/guis/gui-advanced-tips/creating-responsive-loops
Responsive Forms
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.
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.
Re: Responsive Forms
So I looked again at the "Button-Start Job" code along with a longer look at the Creating Responsive Forms and Responsive Loops.
I think It's starting to sink in a bit I'm still not getting something. I used your "Demo-JobChildForm" as a template, I have a main form with one button that opens the child form below. Using the code from the "Creating Responsive Forms" I can get the ping to run and the progress bar to fill. I edited that to try doing a copy-Item but I can't figure out how to get the progress bar to work with the $count variable.
I'm sure I'm doing something wrong i just can't see where. My best guess is I'm doing something wrong with the $UpdateScript code. Also the files do copy the bar just doesn't reflect that.
I think It's starting to sink in a bit I'm still not getting something. I used your "Demo-JobChildForm" as a template, I have a main form with one button that opens the child form below. Using the code from the "Creating Responsive Forms" I can get the ping to run and the progress bar to fill. I edited that to try doing a copy-Item but I can't figure out how to get the progress bar to work with the $count variable.
I'm sure I'm doing something wrong i just can't see where. My best guess is I'm doing something wrong with the $UpdateScript code. Also the files do copy the bar just doesn't reflect that.
- param
- (
- $JobName = 'MyJob'
- )
- $JobScript =
- {
- $Source = 'C:\Users\tuser\Desktop'
- $Destination = 'C:\Users\tuser\Documents\TestCopy'
- [int]$Count = $Source.count
- for ($i = 0; $i -lt "$($Count)"; $i++)
- {
- #Do some work
- Copy-Item -Path $Source -Destination $Destination -Recurse
- #Start-Sleep -Milliseconds 100
- #Output Progress
- $i + 1
- }
- }
- $UpdateScript =
- {
- Param ($Job)
- $results = Receive-Job -Job $Job | Select-Object -Last 1
- if ($results -is [int])
- {
- $PBar_Copy.Value = $results
- }
- }
- $CompletedScript =
- {
- Param ($Job, $Count)
- $PBar_Copy.Value = $Count
- }
- $formChildForm_Load={
- #TODO: Place custom script here
- Add-JobTracker -Name $JobName -JobScript $jobscript -UpdateScript $updatescript -CompletedScript $completedscript
- }
Re: Responsive Forms
Is there any other way to show the progress during a file copy? Would a Marquee Progress bar work?
Do you have any recommendations for show progress on a file copy, that could show a percentage done or anything?
Would Copy-WithProgress work better?
Do you have any recommendations for show progress on a file copy, that could show a percentage done or anything?
Would Copy-WithProgress work better?