| View previous topic :: View next topic |
| Author |
Message |
el Guest
|
Posted: Sun Nov 01, 2009 6:34 am Post subject: expressions |
|
|
| Code: |
x+=10
y+=20
click, %x%, %y%
|
how can i combine those 3 lines to 1? or can i?
something like:
| Code: |
click, %x%+10, %y%+20 |
|
|
| Back to top |
|
 |
el Guest
|
Posted: Sun Nov 01, 2009 6:44 am Post subject: |
|
|
i think i got it, it seems working correctly with this syntax
| Code: | | click, % (x+10)","(y+20) |
ehmm..interesting, tried many different ways, seems like click is only using one variable input % |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 7159
|
Posted: Sun Nov 01, 2009 6:51 am Post subject: |
|
|
You could also user define Commands into Functions.
| Code: | X:=0, Y:=0, Click( X:=X+10, Y:=Y+10), Click( X:=X+10, Y:=Y+10), Click( X:=X+10, Y:=Y+10)
Click( X, Y ) {
Click, %X%, %Y%
} |
_________________ Suresh Kumar A N |
|
| Back to top |
|
 |
el Guest
|
Posted: Sun Nov 01, 2009 7:06 am Post subject: |
|
|
| icic, thanks for the quick tip |
|
| Back to top |
|
 |
el Guest
|
Posted: Sun Nov 01, 2009 7:11 am Post subject: |
|
|
one more question
can u please explain a little bit how ahk works differently on these 2 scripts:
| Code: | s:=a_tickcount
loop 100000
{
x:=0,y:=0,z:=0
}
e := A_tickcount - s
msgbox, % e
|
| Code: |
s:=a_tickcount
loop 100000
{
x:=0
y:=0
z:=0
}
e := A_tickcount - s
msgbox, % e |
surprisingly, the first script is 30-40% slower |
|
| Back to top |
|
 |
sinkfaze
Joined: 18 Mar 2008 Posts: 2427
|
Posted: Sun Nov 01, 2009 7:23 am Post subject: |
|
|
The maximum I'm hitting is about 20% difference in speed.
I'm sure to be trumped by those more knowledgeable, but my guess is that with the former, the single line command has to be parsed by AHK before assigning the values to the variables, whereas in the latter there are no steps in between variable assignments. _________________ Try Quick Search for Autohotkey or see the tutorial for newbies. |
|
| Back to top |
|
 |
Guest
|
Posted: Sun Nov 01, 2009 7:37 am Post subject: |
|
|
ehm make sense
i dont really care about the performance difference for that 0.001ms
but its good to know, what performance better
well i guess its depends on user's choice, it is tidy+short vs. performance
thank you |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 7159
|
Posted: Sun Nov 01, 2009 8:01 am Post subject: |
|
|
| el wrote: | | can u please explain a little bit how ahk works differently on these 2 scripts |
It is tricky - there are instances where comma seperated values can outperform single line declarations owing to many micro-optimizations applied into the code by the developer. I am not aware of all, but I have seen that
X := 1 is faster than X := 0 which is faster that X := "" |
|
| Back to top |
|
 |
|