Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
SolvedPrivate

Adding a countdown to HTA

Posted on 2017-03-15
12
Medium Priority
?
145 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
[X]
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
12 Comments
 
LVL 35

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 35

Expert Comment

by:Shaun Vermaak
ID: 42054612
No, it doesn't. The code pattern is very similar to HTA
0
More Than Just A Video Library

Train for your certification. Learn the latest DevOps tools. Grow your skillset to do better work.

At Linux Academy, we release new training modules every week so you'll always be up to date on the latest tech.

 
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 35

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 35

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

Technology Partners: 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!

Question has a verified solution.

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

This is a fine trick which I've found useful many times, when you just don't want to accidentally run a batch script or the commands needs administrator rights.
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
Starting up a Project
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

719 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