Adding a countdown to HTA

Posted on 2017-03-15
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.
Question by:NetRock6
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
  • +2
LVL 30

Expert Comment

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

Expert Comment

ID: 42054609

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

Expert Comment

by:Shaun Vermaak
ID: 42054612
No, it doesn't. The code pattern is very similar to HTA
Free eBook: Backup on AWS

Everything you need to know about backup and disaster recovery with AWS, for FREE!

LVL 45

Expert Comment

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

Accepted Solution

Daz_1234 earned 500 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.

LVL 30

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

LVL 45

Expert Comment

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.
LVL 30

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

Author Comment

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:

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...... (;
LVL 25

Expert Comment

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:

LVL 13

Expert Comment

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.


Author Closing Comment

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

Featured Post

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
While loop multiple conditions 5 34
Poweshell to Ping and return Last 3 users 3 50
CSS styling problem 3 28
AD Computer Objects in VB .Net 2 20
This article was originally published on Monitis Blog, you can check it here . Today it’s fairly well known that high-performing websites and applications bring in more visitors, higher SEO, and ultimately more sales. By the same token, downtime…
My attempt to use PowerShell and other great resources found online to simplify the deployment of Office 365 ProPlus client components to any workstation that needs it, regardless of existing Office components that may be needing attention.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

751 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