Jump to content
Macro Express Forums

Doing some simple math in Macro Express


Recommended Posts

Suppose I want to count down in a text file, starting with X, as follows, for example:

 

100

99

98

 

Please see the following:

<VARIABLE SET INTEGER Option="\x00" Destination="%Initial%" Value="100"/>

 

I think I use the above.  It designates where to start. 100.

 

How, then, do I get the 99, and 98?

 

Can I set up some math?  Say, %Initial% minus (-) 1, to get the 99?

 

And %Initial% minus (-) 2, to get the 98?

 

Any help appreciated.

 

Nicholas Kormanik

 

Link to comment
Share on other sites

This is not a "bullet-proof" solution, but the code might give you ideas of how to solve it.

 

Variable Set Integer %Value%: Prompt
Variable Set Integer %Interval%: Prompt
 
Repeat Until %Value% Is Less Than "1"
  Text Type (Simulate Keystrokes): %Value%

  Variable Modify Integer: %Value% = %Value% - %Interval%
End Repeat

<VARIABLE SET INTEGER Option="\x01" Destination="%Value%" Prompt="What is the highest value?" Mask="FALSE" OnTop="TRUE" Left="Center" Top="Center" Monitor="0" Lines="\x00"/>
<VARIABLE SET INTEGER Option="\x01" Destination="%Interval%" Prompt="Count down by what value?" Mask="FALSE" OnTop="TRUE" Left="Center" Top="Center" Monitor="0" Lines="\x00"/>
<COMMENT/>
<REPEAT UNTIL Variable="%Value%" Condition="\x02" Value="1"/>
<TEXT TYPE Action="0" Text="%Value%\r\n"/>
<VARIABLE MODIFY INTEGER Option="\x01" Destination="%Value%" Value1="%Value%" Value2="%Interval%"/>
<END REPEAT/>

 

Link to comment
Share on other sites

Indeed it does, acantor.  I love your 'Prompt' suggestion.  That would mean I wouldn't have to manually edit the macro files, which has been a pain.

 

The rest I'll have to study more.

 

Maybe the first step would be to just try it out, eh?  Like in a plain text page, editor.

 

Thanks for stepping forward.

 

 

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...