Jump to content
Macro Express Forums

Visible counter & Visible Timer (countdown)


Recommended Posts

Hello,

New macro.

 

would like to put both a VISIBLE counter and a VISIBLE timer (countdown) into script...

 

Macro

refreshes page

looks for text

     if text there...sounds alarm and stops

     if text not there waits 45 seconds

repeats.

 

Is there a way to have a counter on the page indicating how many times the macro has run

&

Is there a way to show a timer (countdown) of the 45 seconds until when the macro will repeat?

 

Thanks

F

Link to comment
Share on other sites

If I understand you correctly it's easy to open a message box and then update it periodically with a loop. If it doesn't need to be hyper active you can just put the delay in the loop. I typically do 1 second delays. In your case the loop would be 45 seconds. Each look updates the message box's contents however you like.

Link to comment
Share on other sites

thanks for reply...

 

Still learning all the commands...

Assume Countdown is 45 seconds (variable S)

here is what I have...

 

<VARIABLE SET STRING Option="\x01" Destination="%W%" Prompt="What words needs to appear on screen to sound alarm?" Mask="FALSE" OnTop="FALSE" Left="Center" Top="Center" Monitor="0" _COMMENT="WHAT WORD(S) LOOKING FOR ON SCREEN"/>
<VARIABLE SET INTEGER Option="\x01" Destination="%S%" Prompt="How many SECONDS between searches?" Mask="FALSE" OnTop="FALSE" Left="Center" Top="Center" Monitor="0" _COMMENT="HOW MANY SECONDS BETWEEN REFRESHES"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%X%" Value="0" _COMMENT="WHEN EQUALS \"1\", MACRO STOPS"/>
<REPEAT UNTIL Variable="%X%" Condition="\x00" Value="1"/>
<TEXT TYPE Action="0" Text="<F5>"/>
<DELAY Flags="\x01" Time="6"/>
<TEXT TYPE Action="0" Text="<CTRLD>a<CTRLU>"/>
<DELAY Flags="\x01" Time="1"/>
<TEXT TYPE Action="0" Text="<CTRLD>c<CTRLU>"/>
<DELAY Flags="\x01" Time="1"/>
<IF CLIPBOARD Option="\x01" Text="%W%" CaseSensitive="FALSE"/>
     <DELAY Flags="\x01" Time=".5"/>
     <SOUND FILE File="C:\\Users\\frank\\Desktop\\SOUNDS\\1-1-1-Tornado 1minute 30 seconds.wav" Wait="FALSE" _PROMPT="0x0007"/>
     <DELAY Flags="\x01" Time="1"/>
     <VARIABLE SET INTEGER Option="\x00" Destination="%X%" Value="1"/>
<END IF/>
<DELAY Flags="\x01" Time="%S%"/>
<END REPEAT/>

 

Where do I enter the MESSAGE BOX?  (after last delay?)

How do I get it to show 45,44,43,42...etc (it can disappear when only 3 seconds left)

(hopefully in real time, meaning 1 second countdown)
 

 

Link to comment
Share on other sites

Here's a script that does something similar:

 

Variable Set Integer %Counter% to 5
Text Box Display: Testing
Repeat Until %Counter% Equals "0"
  Text Box Update: Testing
  Delay: 1 seconds
  Variable Modify Integer: %Counter% = %Counter% - 1
End Repeat
Text Box Close: Testing

<VARIABLE SET INTEGER Option="\x00" Destination="%Counter%" Value="5"/>
<TEXT BOX DISPLAY Title="Testing" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\lang4105\\f0\\fs40 %Counter%\\lang1033\\f1\\fs14 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x01" Delay="0"/>
<REPEAT UNTIL Variable="%Counter%" Condition="\x00" Value="0"/>
<TEXT BOX UPDATE Header="Testing" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\lang4105\\f0\\fs40 %Counter%\\lang1033\\f1\\fs14 \r\n\\par }\r\n"/>
<DELAY Flags="\x01" Time="1"/>
<VARIABLE MODIFY INTEGER Option="\x01" Destination="%Counter%" Value1="%Counter%" Value2="1"/>
<END REPEAT/>
<TEXT BOX CLOSE Header="Testing"/>
	

 

Link to comment
Share on other sites

where do i put the commands that you suggest into my commands?

 

I would guess after the last delay...?

 

I appreciate the advice i just want to try to implement it and test but would like a good starting point...

 

Thanks!


 

 

Link to comment
Share on other sites

My script probably can't be inserted into your script.

 

A good starting point is to simplify.

 

My script is a basic countdown. Run my script. Observe what it does, and figure out how to works.

 

Then modify my code, one step at a time. Or modify your code based on my code. Feel free to borrow!

Link to comment
Share on other sites

1 hour ago, Frank said:

where do i put the commands that you suggest into my commands?

 

Using the example posted by ACantor, highlight the part that begins with <VARIABLE SET all the way through and including <TEXT BOX CLOSE Header="Testing"/> and type Ctrl+c. Then create a new, blank macro and press Ctrl+v to paste the macro into it.

Link to comment
Share on other sites

I know I sound like a broken record...

 

YOU GUYS ARE THE BEST!!!

 

I used the script and was able to get the outcome for the timer!!!

I had to delete the delay at the bottom of script.  it was not necessary because

of the delay 1 second in the repeat for changing the text box message.

BUT I HAVE A WORKING macro...

 

Thanks, 

F

 

( I have a new question that I will post about IF contains...)

Link to comment
Share on other sites

Cantor I was just reminded of something I used to do but fell out of the habit of. For newbs that are having a problem just knowing where and how to do things, I'd ofent make my examples into MEX and send them the MEX file. That way they can run it, see it run, then open in the editor and learn how to apply it to thier case. Saves the confusion over undefined variables and such. Just a suggestion. 

  • Thanks 1
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...