SolvedPrivate

Adding a countdown to HTA

Posted on 2017-03-15
12
92 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 27

Expert Comment

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

Expert Comment

by:aikimark
ID: 42054609
@Shaun

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

Expert Comment

by:Shaun Vermaak
ID: 42054612
No, it doesn't. The code pattern is very similar to HTA
0
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 
LVL 45

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

Daz.
ee.hta.txt
0
 
LVL 27

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 45

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 27

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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

713 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