<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Approximatrix Forums — Giving Back - a progress bar of sorts for Mac]]></title>
	<link rel="self" href="http://forums.approximatrix.com/extern.php?action=feed&amp;tid=851&amp;type=atom" />
	<updated>2022-04-10T07:05:21Z</updated>
	<generator>PunBB</generator>
	<id>http://forums.approximatrix.com/viewtopic.php?id=851</id>
		<entry>
			<title type="html"><![CDATA[Giving Back - a progress bar of sorts for Mac]]></title>
			<link rel="alternate" href="http://forums.approximatrix.com/viewtopic.php?pid=3903#p3903" />
			<content type="html"><![CDATA[<p>Below is the code for a simplified progress bar I set up for a routine that was running for more than a minute.<br />I wanted to be sure things were still humming along without periodically printing out increment numbers.</p><p>It&#039;s nice in that it only takes up two lines of the &quot;screen&quot; and can be easily modified for the situation at hand.</p><p>! MyTotalLoops is the number of the maximum loops in my Do/EndDO structure<br />! nStep is my progress bar increment. I wanted 10 steps so it&#039;s MyTotalLoops/10<br />! ss is a counter that triggers printing a progress step when ss equals nStep. Then ss is reset</p><p>Integer(16) MyTotalLoops, nStep, ss<br /> nStep = MyTotalLoops/10</p><p>! Before the loop, I print out numbers 1 to 10 - my progress steps - then write some spaces on a second line so the<br />! progress steps will line up under the numbers 1 thru 10<br />! The font is different in this message area so you don&#039;t see that the second line of spaces<br />! starts at the P and stops just before the &quot;1&quot;</p><p>&nbsp; &nbsp; Write (*,*)<br />&nbsp; &nbsp; Write (*,&#039;(a)&#039;)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#039;Progress Steps: 1,2,3,4,5,6,7,8,9,10&#039;<br />&nbsp; &nbsp; Write (*,&#039;(a)&#039;,advance=&#039;no&#039;) &#039;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#039;<br />! The ..., advance = &#039;no&#039;) keeps the &#039;print point&#039; from moving down a line</p><p>! I initialize ss at the beginning of the big Do Loop<br />&nbsp; ss = 1<br />Do<br />! Your task goes here<br />.<br />.<br />.<br />! At the bottom of the loop, above the EndDo, I increment my step counter, compare it to the progress bar increment,<br />! If it is equal, I write out a progress bar step and reset the counter</p><p>! Count steps and write out progress<br />&nbsp; &nbsp; ss = ss + 1<br />&nbsp; &nbsp; IF (ss == nStep) Then<br />&nbsp; &nbsp; &nbsp; &nbsp; ss = 1<br />&nbsp; &nbsp; &nbsp; &nbsp; Write(*,&#039;(a2)&#039;, advance = &#039;no&#039;) &#039;==-&#039;<br />! The ... , advance = &#039;no&#039;) &#039;--&quot; keeps the progress dashes moving along on the same line below progress step numbers<br />&nbsp; &nbsp; Endif</p><p>EndDo</p><p>! I do another write to drop below the progress bar and print out my work results<br />Write (*,*)</p><br /><p>Of course, this adds a little overhead to the computing task, but there is something comforting about having an indication that the program is faithfully chugging away while not pushing everything off-screen as would happen when printing increment numbers.</p><p>I hope this helps a Mac user who is jonesing for a progress indicator.<br />It will run on Windows too, but Windows has AppGraphics with its more sophisticated progress bar.<br />This one is good enough for my tasks.</p><p>if some unicode/font options are available, you might find a thicker bar character than the equal sign.</p>]]></content>
			<author>
				<name><![CDATA[designer]]></name>
				<uri>http://forums.approximatrix.com/profile.php?id=3903</uri>
			</author>
			<updated>2022-04-10T07:05:21Z</updated>
			<id>http://forums.approximatrix.com/viewtopic.php?pid=3903#p3903</id>
		</entry>
</feed>
