Jump to content
Macro Express Forums
biplab54

Time Remaining & Counter Dialog Box

Recommended Posts

I have simple macro with same task repeated for more then 10,000 times. Is there a way i can display a message at the corner of the screen which will show me repeat countdown and remaining time to complete the task? Message should update after completion of every repeat.

Share this post


Link to post
Share on other sites

Yes. Use the Text Box commands. Start with Display then update it however often you want, then Close. 

Share this post


Link to post
Share on other sites
2 hours ago, biplab54 said:

Message should update after completion of every repeat.

You may find that displaying the message that often slows down your processing. Some of my macros update the counter every 25 iterations while other macros update every 100.

 

Here is a snippet of one of my macros. It works just as Cory suggested. This sample uses the ASCII File Begin/End Process loop but a Repeat loop will work just as well

Text Box Display: Progress
// Process the file
ASCII File Begin Process: "D:\ZZZZ\csv\zd.csv" (Comma Delimited Text (.csv))
 
// Display progress counter
  Variable Modify Integer: %N[2]% = %N[1]% / 100
  If Variable %N[2]% Does not Equal "%N[3]%"
    Text Box Update: Progress
    Variable Modify Integer set %N[3]% to the contents of %N[2]%
  End If

ASCII File End Process
<TEXT BOX DISPLAY Title="Progress" Content="{\\rtf1\\ansi\\deff0{\\fonttbl{\\f0\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\lang1033\\f0\\fs16 \r\n\\par     Processing line number: %N[1]%\r\n\\par }\r\n" Left="Right" Top="Top" Width="327" Height="114" Monitor="0" OnTop="TRUE" Keep_Focus="FALSE" Mode="\x02" Delay="1"/>
<COMMENT Value="Process the file"/>
<ASCII FILE BEGIN PROCESS Filename="D:\\ZipCodeDownload\\csv\\zd.csv" Format="CSV" Start_Record="1" Process_All="TRUE" Records="1" Variable="%T%" Start_Index="10"/>
<COMMENT Value="Display progress counter"/>
<VARIABLE MODIFY INTEGER Option="\x03" Destination="%N[2]%" Value1="%N[1]%" Value2="100"/>
<IF VARIABLE Variable="%N[2]%" Condition="\x01" Value="%N[3]%" IgnoreCase="FALSE"/>
<TEXT BOX UPDATE Header="Progress" Content="{\\rtf1\\ansi\\deff0{\\fonttbl{\\f0\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\lang1033\\f0\\fs16 \r\n\\par     Processing line number: %N[1]%\r\n\\par }\r\n"/>
<VARIABLE MODIFY INTEGER Option="\x06" Destination="%N[3]%" Variable="%N[2]%"/>
<END IF/>
<COMMENT/>
<ASCII FILE END PROCESS/>

 

Share this post


Link to post
Share on other sites

Samrae is right. If the frequency is more than about once a second, I tend to calculate and only do updates then. Sometimes as a percentage. Or maybe one ever hundred times. And if  the period varies much I'll use a time variable. Like maybe add 5 seconds to the current time and compare each time until the current time is more than the saved time.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...