Go Premium for a chance to win a PS4. Enter to Win

x
?
SolvedPrivate

Adding a countdown to HTA

Posted on 2017-03-15
12
Medium Priority
?
152 Views
Last Modified: 2017-04-04
Hi ...
I was wondering if someone could help me out. I am working on the attached hta file,
and not able to get the followings working:

1) Make the background color "red: StartColorStr='#000000', EndColorStr='#FF0000'",
2) Being able to run Powershell script ( example in line # 87),
3) Get the error code for the powershell script every time runs and send it to a log file,
3) Create a coutdown while progress bar advancing,
4) When adding more output: "Now I'm doing something else..." does not overlap with the prevoius output and the last output always be just above the progress bar. Right Now if I add more command to run it overlaps and also progress bar covering the output.

Thank you so much for your help.
Your Quick Prompts Highly Appreciated.
HTA_POPUP_BAR.txt
0
Comment
Question by:NetRock6
  • 4
  • 3
  • 2
  • +2
12 Comments
 
LVL 37

Expert Comment

by:Shaun Vermaak
ID: 42054578
You should write the UI with Powershell
0
 
LVL 46

Expert Comment

by:aikimark
ID: 42054609
@Shaun

Wouldn't that require Sapiens software (or similar)?
0
 
LVL 37

Expert Comment

by:Shaun Vermaak
ID: 42054612
No, it doesn't. The code pattern is very similar to HTA
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 46

Expert Comment

by:aikimark
ID: 42054724
Rendering a UI with Powershell means creating a WinForm, right?
0
 
LVL 13

Accepted Solution

by:
Daz_1234 earned 2000 total points
ID: 42054828
Hi I've made some amendments to the hta and re-attached to this comment.  To answer your points:

1. For some reason (probably a bug) I can't get the 'body' to take the gradient.  I got around that by removing the margin (margin:0) and putting the gradient on a window-sized div.

2. Done

3. Done

3. Not sure what you meant but I put on the item number counting down in brackets before the output.

4. Again not sure what you mean, it already does not over lap, but as you say if you have many things then it will overwrite the bar.  I suggest you use a div with a scrollbar.

Good luck and feel free to ask if you need more info.

Daz.
ee.hta.txt
0
 
LVL 37

Expert Comment

by:Shaun Vermaak
ID: 42055577
Yes, you use this and add your controls to it
# Form
$Form = New-Object System.Windows.Forms.Form    
$Form.Size = New-Object System.Drawing.Size(900,450)  
$Form.MinimumSize = New-Object System.Drawing.Size(900,450)
$Form.MaximumSize = New-Object System.Drawing.Size(900,450)
$Form.SizeGripStyle = "Hide"
$Form.Icon = [System.Drawing.Icon]::ExtractAssociatedIcon($PSHome + "\powershell.exe")
$Form.Text = "Sample"
$Form.ControlBox = $true
$Form.TopMost = $true

Open in new window

0
 
LVL 46

Expert Comment

by:aikimark
ID: 42055644
Since the OP is most familiar with an HTA user interface, it might be helpful to include a link to some material that would describe how to connect their Winform to their PS code.
0
 
LVL 37

Expert Comment

by:Shaun Vermaak
ID: 42055647
Agreed, but before writing the whole thing in Powershell I first want feedback from OP. At this point we have had none
0
 

Author Comment

by:NetRock6
ID: 42055912
Hi ...
Thank You so much for your time and kind help.
It is great to see, finally, the backgroung has been changed!! ;)

For the item No.3, I asked your help to insert countdown of the remaining time similar to this Accurate HTA Countdown and Progress bar:
https://gallery.technet.microsoft.com/scriptcenter/Accurate-HTA-Countdown-and-3fd670d6

Using WinForm and running UI in PS is a great idea and a good learning opportunity that I appreciate your input to show me how it is done...

Thank you for your help...... (;
0
 
LVL 25

Expert Comment

by:Coralon
ID: 42056965
You can also do your UI in XAML with Powershell.  It gives you more of the Metro/Modern/Win8.1/Win10 look & feel compared to the Winforms.  I've been working a lot with with the XAML recently, and the design aspect is a lot easier than the WinForms for the most part; however, there are somethings that are proving to be much tougher.  i.e. a numbers only text box is *way* harder in WPF/XAML than WinForms..

And this is a great place to start:
https://mcpmag.com/articles/2016/04/28/building-ui-using-powershell.aspx

Coralon
0
 
LVL 13

Expert Comment

by:Daz_1234
ID: 42078565
Hi sorry for the delay - attached has a simple countdown.  Of course unless you can calculate the proper amount of time the countdown is very arbitrary, but it does demonstrate the use of window.setInterval.  Good luck.

Daz.
ee2.hta.txt
0
 

Author Closing Comment

by:NetRock6
ID: 42079366
Thank YOU For Your Help .... Keep up the Good Job!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
When you discover the power of the R programming language, you are going to wonder how you ever lived without it! Learn why the language merits a place in your programming arsenal.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Starting up a Project
Suggested Courses

782 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question