Solved

autoit progress bar

Posted on 2014-12-31
7
825 Views
Last Modified: 2014-12-31
How would I make what I would think is a simple progress bar?
What I want is to enter a start number say 300 and then a goal number say 245 and it show the number and percentage mark.

I was thinking something like
ProgressOn ("Progress bar", "Start and Goal", "Working...")
$start = inputbox ("start value","enter value")
$goal = inputbox ("goal value", enter value")

$percentcomplete = $g/$c

ProgressSet($percentcomplete)

Open in new window


I'm very new to this. Thanks!
0
Comment
Question by:bbimis
7 Comments
 
LVL 30

Expert Comment

by:flubbster
ID: 40525497
Here is a simple one I found that you can modify:

 ProgressOn("Progress Bar", "Sample progress bar", "Working...")
 
 For $i = 0 To 100
       ProgressSet($i)
       Sleep(5)
 Next
 
 ProgressSet(100, "Done!")
 Sleep(750)
 ProgressOff()


Not sure I understand your start and goal numbers. Do you mean you want to increment another 245? Or go down from 300 to 245? Your division would give you a very small number. Perhaps you could explain a bit more.
0
 
LVL 78

Expert Comment

by:David Johnson, CD, MVP
ID: 40525503
ProgressOn ("Progress bar", "Start and Goal", "Working...")
$start = inputbox ("start value","enter value")
$goal = inputbox ("goal value", enter value")
$percentcomplete = ($g/$c) [b]* 100[/b]
ProgressSet($percentcomplete)
 ProgressSet(100, "Done!")

Open in new window


it needs a percentage which is (current value/ max value) * 100
0
 

Author Comment

by:bbimis
ID: 40525511
I'm trying to do something like this then I can fix the graphical part of it.  
the math just isn't clicking for me.
$c = InputBox("Start Weight", "Enter current Weight")
$g = InputBox("Goal Weight", "Enter Goal Weight")

   $TotalPoundstoLoose = $c * .04 ;Four percent of the weight needed to loose in terms of pounds
   MsgBox(0,"total",$TotalPoundstoLoose) ; used for testing
   $Lost = $c - $g ; amount of wait currently lost
   $percent = $lost/$TotalPoundstoLoose ; percentage out of 100 for ticker/progress bar
   MsgBox(0,"lost",$lost); used for testing
   
	MsgBox(0,"Percent", $percent); used for testing
	$value = $Lost * 100 ; percentage converted to 100 for ticker
	ProgressOn("Progress Bar", "Sample progress bar", "Working...")
   ProgressSet($value)
 	Sleep(750)


 ;ProgressSet(100, "Done!")
 Sleep(750)
 ProgressOff()

Open in new window

0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 

Author Comment

by:bbimis
ID: 40525556
Basically what I'm trying to do is make it where lets say I weigh 280
I want to loose 4 percent of that weight which is 11.2 pounds

I want the percentage to reflect how close I am to that goal
Basically a weight loss ticker.
thanks!
0
 
LVL 51

Expert Comment

by:Joe Winograd, EE MVE
ID: 40525585
Since you're very new to this, you may want to consider a similar language called AutoHotkey. I think it is better than AutoIT, although there are certainly folks who think the opposite. But if you're not already wedded to AutoIT, take a look at AutoHotkey (also free, of course). There have been many forks of the original language and recently a new community was established to move the language forward. The latest release at the new community has a Windows installer, an offline help file, and a compiler that turns the AHK source code (plain text) into a stand-alone/no-install executable (an EXE file).

There is excellent documentation:
http://ahkscript.org/docs/AutoHotkey.htm

...including an alphabetical command and function index:
http://ahkscript.org/docs/commands/index.htm

...a good tutorial:
http://ahkscript.org/docs/Tutorial.htm

...and an active user forum:
http://ahkscript.org/boards/

If you'd like to see AutoHotkey in full programs, here are a few EE articles that I've written with source code:

http://www.experts-exchange.com/Web_Development/Document_Imaging/A_10745-How-To-Combine-Merge-Append-TIFF-Files-in-Batch-Mode.html

http://www.experts-exchange.com/Web_Development/Document_Imaging/A_11173-How-To-Rename-Move-a-Batch-of-PDF-Files-Based-on-Contents-of-the-Files.html

http://www.experts-exchange.com/Web_Development/Document_Imaging/A_11211-How-To-Split-Rename-Move-a-Batch-of-PDF-Files-Based-on-Contents-of-the-Files.html

In terms of the progress bar, here are two lines of code from one of those articles that will do it:

barprogress:=100*(A_Index/numfiles)
Progress,%barprogress%,%A_LoopField%,Processing,Combining

The complete syntax for the Progress command is:

Progress, ProgressParam1 [, SubText, MainText, WinTitle, FontName]

Also, here's the command to turn off the progress bar:

Progress,Off

Regards, Joe
0
 
LVL 78

Accepted Solution

by:
David Johnson, CD, MVP earned 500 total points
ID: 40525672
	$starting = InputBox("Start Weight", "Enter Starting Weight")
	$current = InputBox("Current Weight","Enter Current Weight")
	$TotalPoundstoLoose = $starting * .04 
	MsgBox(0,"Your Goal Pounds to Lose:",$TotalPoundstoLoose) ; used for testing
	$Lost = $Starting - $current ; amount of weight currently lost
	$percent = ($lost/$TotalPoundstoLoose) * 100 ; percentage out of 100 for ticker/progress bar
	MsgBox(0,"You have lost:",$lost); used for testing
	MsgBox(0,"Which is Percent of your Goal", $percent); used for testing
	ProgressOn("Progress Bar", "Goal Achievement", "Working...")
	ProgressSet($percent)
 	Sleep(1750)
	ProgressOff()

Open in new window

0
 

Author Closing Comment

by:bbimis
ID: 40525678
thanks!
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

A short article about a problem I had getting the GPS LocationListener working.
Possible fixes for Windows 7 and Windows Server 2008 updating problem. Solutions mentioned are from Microsoft themselves. I started a case with them from our Microsoft Silver Partner option to open a case and get direct support from Microsoft. If s…
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)
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

707 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now