Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Private
  • Views: 166
  • Last Modified:

Adding a countdown to HTA

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
NetRock6
Asked:
NetRock6
  • 4
  • 3
  • 2
  • +2
1 Solution
 
Shaun VermaakTechnical Specialist/DeveloperCommented:
You should write the UI with Powershell
0
 
aikimarkCommented:
@Shaun

Wouldn't that require Sapiens software (or similar)?
0
 
Shaun VermaakTechnical Specialist/DeveloperCommented:
No, it doesn't. The code pattern is very similar to HTA
0
Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to Squarespace.com and use offer code ‘EXPERTS’ to get 10% off your first purchase.

 
aikimarkCommented:
Rendering a UI with Powershell means creating a WinForm, right?
0
 
Daz_1234Commented:
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
 
Shaun VermaakTechnical Specialist/DeveloperCommented:
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
 
aikimarkCommented:
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
 
Shaun VermaakTechnical Specialist/DeveloperCommented:
Agreed, but before writing the whole thing in Powershell I first want feedback from OP. At this point we have had none
0
 
NetRock6Author Commented:
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
 
CoralonCommented:
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
 
Daz_1234Commented:
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
 
NetRock6Author Commented:
Thank YOU For Your Help .... Keep up the Good Job!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

  • 4
  • 3
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now