Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know this works

x = 625 + offset
Click %x%, 575

But

Click %625 + offset%, 575

or

Click 625 + %offset%, 575

doesn't work.

Any suggestions on how I can have math expressions with commands?

share|improve this question
up vote 0 down vote accepted

From Variables and Expressions

Force an expression: An expression can be used in a parameter that does not directly support it (except an OutputVar or InputVar parameter such as those of StringLen) by preceding the expression with a percent sign and a space or tab. This technique is often used to access arrays. For example:

FileAppend, % MyArray%i%, My File.txt
MsgBox % "The variable MyVar contains " . MyVar . "."
Loop % Iterations + 1
WinSet, Transparent, % X + 100
Control, Choose, % CurrentSelection - 1

So I suggest you try:

Click % 625 + %offset%, 575

If that doesn't work, it might be because the Click documentation specifically says:

Since click does not support expressions, variables should be enclosed in percent signs.

If that happens, it might be worth trying MouseClick instead, as its documentation specifically says:

The x/y coordinates to which the mouse cursor is moved prior to clicking, which can be expressions.

share|improve this answer
    
thanks a lot...great help – Jim Ruirong Chen Nov 12 '11 at 1:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .