Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.