Jump to content
Macro Express Forums

Timer show delay


Recommended Posts

Hi coming from ME3 - now trying in MEP

 

Mean i create a delay of 25 minutes or so and sometimes i want to know how long the delay is running in that moment.

so is there a chance to set up a counter so i can see how long it takes to the end of the delay?

 

I need to know when the delay ends!

Link to comment
Share on other sites

Hi coming from ME3 - now trying in MEP

 

Mean i create a delay of 25 minutes or so and sometimes i want to know how long the delay is running in that moment.

so is there a chance to set up a counter so i can see how long it takes to the end of the delay?

 

I need to know when the delay ends!

 

Here's my demo:

 

Macro Run: Macro1-StartTimeDelay
Delay: 100 milliseconds
Variable Set Integer %HoursSoFar% to 0
Variable Set Integer %MinsSoFar% to 0
Variable Set Integer %SecsSoFar% to 0
Variable Restore: Restore Date/Time Variables
Convert Date/Time to Decimal: %DateTime1% => %DateTime1Dec%
Repeat Start (Repeat 180 times)
 Date/Time: Set %DateTime2% to the current date/time
 Convert Date/Time to Decimal: %DateTime2% => %DateTime2Dec%
 Variable Modify Decimal: %DelaySofar% = %DateTime2Dec% - %DateTime1Dec%
 Convert Decimal to Date/Time: %DelaySofar% => %DelaySoFarDateTime%
 Variable Modify Date/Time: Extract hour into HoursSoFar
 Variable Modify Date/Time: Extract minute into MinsSoFar
 Variable Modify Date/Time: Extract second into SecsSoFar
 Text Box Display: Message in 2nd macro
 Delay: 1 seconds
 Text Box Close: Message in 2nd macro
End Repeat

 

And the direct editor code:

 

<MACRO RUN Use_ID="FALSE" Name="Macro1-StartTimeDelay" ID="-1" Wait="FALSE"/>
<DELAY Flags="\x02" Time="100"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%HoursSoFar%" Value="0"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%MinsSoFar%" Value="0"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%SecsSoFar%" Value="0"/>
<VARIABLE RESTORE Option="\x06"/>
<CONVERT DATE/TIME TO DECIMAL Source="%DateTime1%" Dest="%DateTime1Dec%"/>
<REPEAT START Start="1" Step="1" Count="180" Save="FALSE"/>
<DATE/TIME Format="h:mm:ss AMPM" Flags="\x80" Date="30/12/1899" Day_Offset="0" Month_Offset="0" Year_Offset="0" Hour_Offset="0" Second_Offset="0" Left="Center" Top="Center" Monitor="0" Variable="%DateTime2%" IsDateVar="TRUE" _IGNORE="0x0002"/>
<CONVERT DATE/TIME TO DECIMAL Source="%DateTime2%" Dest="%DateTime2Dec%"/>
<VARIABLE MODIFY DECIMAL Option="\x01" Destination="%DelaySofar%" Value1="%DateTime2Dec%" Value2="%DateTime1Dec%"/>
<CONVERT DECIMAL TO DATE/TIME Source="%DelaySofar%" Dest="%DelaySoFarDateTime%"/>
<VARIABLE MODIFY DATE/TIME DateVar="%DelaySoFarDateTime%" Option="\x05" LeftVar="HoursSoFar" UseInteger="FALSE" MathOpt="\x00"/>
<VARIABLE MODIFY DATE/TIME DateVar="%DelaySoFarDateTime%" Option="\x06" LeftVar="MinsSoFar" UseInteger="FALSE" MathOpt="\x00"/>
<VARIABLE MODIFY DATE/TIME DateVar="%DelaySoFarDateTime%" Option="\x07" LeftVar="SecsSoFar" UseInteger="FALSE" MathOpt="\x00"/>
<TEXT BOX DISPLAY Title="Message in 2nd macro" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\qc\\lang2057\\f0\\fs16 The first macro has now been delayed for\r\n\\par \\b %HoursSoFar% hours, %MinsSoFar% mins, %SecsSoFar% secs\r\n\\par }\r\n" Left="1329" Top="467" Width="388" Height="114" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x02" Delay="0"/>
<DELAY Flags="\x01" Time="1"/>
<TEXT BOX CLOSE Header="Message in 2nd macro"/>
<END REPEAT/>

 

And the same for the first macro:

Date/Time: Set %DateTime1% to the current date/time
Variable Save: Save Date/Time Variables
Text Box Display: Delay Start
Delay: 120 seconds
Text Box Close: Delay Start

 

<DATE/TIME Format="h:mm:ss AMPM" Flags="\x80" Date="30/12/1899" Day_Offset="0" Month_Offset="0" Year_Offset="0" Hour_Offset="0" Second_Offset="0" Left="Center" Top="Center" Monitor="0" Variable="%DateTime1%" IsDateVar="TRUE" _IGNORE="0x0002"/>
<VARIABLE SAVE Option="\x06"/>
<TEXT BOX DISPLAY Title="Delay Start" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0{\\fonttbl{\\f0\\fnil Tahoma;}{\\f1\\fnil\\fcharset0 Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\lang2057\\f0\\fs16 The delay \\f1 in the first macro \\f0 started at:\\f1  \\f0 %DateTime1%\r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x02" Delay="0"/>
<DELAY Flags="\x01" Time="120"/>
<TEXT BOX CLOSE Header="Delay Start"/>

 

Adapt to suit. For example, you could show the time remaining instead of the time so far.

 

--

Terry, East Grinstead, UK

Link to comment
Share on other sites

something does not really work - i get the text box repeating every seconds so i cant work .

 

 

isn't there not a chance to get a macro like the first one ->

 

 

 

 

<DATE/TIME Format="h:mm:ss AMPM" Flags="\x80" Date="30.12.1899" Day_Offset="0" Month_Offset="0" Year_Offset="0" Hour_Offset="0" Second_Offset="0" Left="Center" Top="Center" Monitor="0" Variable="%DateTime1%" IsDateVar="TRUE" _IGNORE="0x0002"/>

<VARIABLE SAVE Option="\x06"/>

<TEXT BOX DISPLAY Title="Delay Start" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0{\\fonttbl{\\f0\\fnil Tahoma;}{\\f1\\fnil\\fcharset0 Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\lang2057\\f0\\fs16 The delay \\f1 in the first macro \\f0 started at:\\f1 \\f0 %DateTime1%\r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x02" Delay="0"/>

<DELAY Flags="\x01" Time="120"/>

<TEXT BOX CLOSE Header="Delay Start"/>

 

 

and just modify it into somthing like this so i get just this message

 

The delay in the first macro ENDS at:%DateTime1%

 

 

means just take the start time added 5 minutes and get the end time

 

like

 

<DATE/TIME Format="h:mm:ss AMPM" Flags="\x80" Date="30.12.1899" Day_Offset="0" Month_Offset="0" Year_Offset="0" Hour_Offset="0" Second_Offset="0" Left="Center" Top="Center" Monitor="0" Variable="%DateTime1%" IsDateVar="TRUE" _IGNORE="0x0002"/>

 

+120 seconds = end time :-)))

Link to comment
Share on other sites

I did not read this completely but here's an idea for you. Set up a repeat loop and display a text box with the end time and then in the loop subtract the end time from the current time and display. Then just add a 1 second delay or whatever you like.

 

You mentioned Terry's solution will not let you work and you're correct. In MEP there is a new command to update a text box instead of closing and opening. In your initial text box use the "Floating Box until..." option and do not choose to keep it on top. Then in each iteration of the loop use the "Update Textbox" command. This will allow you to pull something else up on top and work and you can go back to it whenever you like. You can also reposition as you like. You might also consider adding beeps to the last 10 or so iterations so warn the user that the time is nearly up.

 

Since you are new you should check out the time commands for this macro. If you don't understand serial time read my article here. If you want to do something 25 minutes in the future set a time var, say %End Time% using "Date/Time" with the Adjust the current date/time option. Now in your loop set another time, say %Now% to the current date and time. Now subtract one form the other and then use the Variable Modify Date/Time to extract minutes and seconds if you like to update your text box with. This is a really cool example of how fun the new time vars can be. See my attached sample.

Countdown.mex

Link to comment
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...