Label>Start
OnEvent>KEY_DOWN,VK50,0,Base
OnEvent>KEY_DOWN,VK49,0,Send
SRT>Base
GetCursorPos>xbase,ybase
END>Base
SRT>Send
GetCursorPos>xcurrent,ycurrent
MouseMove>xbase,ybase
Wait>0.01
RCLICK
MouseMove>xcurrent,ycurrent
END>Send
Goto>Start
The endless loop makes the cpu on my computer rise and I don't like that :VK50
GetcursorPos>xbase,ybase
Label>Start
waitkeydown>VK49
GetCursorPos>xcurrent,ycurrent
MouseMove>xbase,ybase
Wait>0.05
RCLICK
MouseMove>xcurrent,ycurrent
Goto>Start
This doesn't work as well as the other one, because for some reason i have to click on the KEY harder on this one (WaitKeyDown>VK49). On the one with the repetitive loop it does the script instantly.
--
How can i fix the script so it won't do as much loops and it will work just as well?
making this script use less cpu?
Moderators: Dorian (MJT support), JRL
Take the onevents out of the loop and add a wait. the onevents only need to be called once and the wait will cut your cpu use. finally I find it easier to visuallize if the subroutines are located outside the loop.
OnEvent>KEY_DOWN,VK50,0,Base
OnEvent>KEY_DOWN,VK49,0,Send
Label>Start
Wait>0.001
Goto>Start
SRT>Base
GetCursorPos>xbase,ybase
END>Base
SRT>Send
GetCursorPos>xcurrent,ycurrent
MouseMove>xbase,ybase
Wait>0.01
RCLICK
MouseMove>xcurrent,ycurrent
END>Send
OnEvent>KEY_DOWN,VK50,0,Base
OnEvent>KEY_DOWN,VK49,0,Send
Label>Start
Wait>0.001
Goto>Start
SRT>Base
GetCursorPos>xbase,ybase
END>Base
SRT>Send
GetCursorPos>xcurrent,ycurrent
MouseMove>xbase,ybase
Wait>0.01
RCLICK
MouseMove>xcurrent,ycurrent
END>Send