Need Help - Repeat 2 commands every 2 secs
#1
Posted 13 April 2012 - 06:10 PM
I didn't find anything scripted like I need it and I am bad in writing scripts.
If you would help me it would be awesome. I really need it for the game I play.
I need a function like this:
I press a button combination to de/activate the script, e.g. "ctrl+y".
Then the script activates the "F1" key and after 0.5 sec delay the "Left Mouse Button".
Then this key combination should be repeated every 2 seconds.
Regards,
Blacky
#2
Posted 13 April 2012 - 06:20 PM
Your code could be:
Settimer, routine, 2000
Settimer, routine, off
enabled=
^Y::
if !enabled
{
enabled = 1
Settimer, routine, on
}
else
{
enabled=
Settimer, routine, off
}
return
routine:
Send, {F1}
Sleep, 500
Click
return
#3
Posted 13 April 2012 - 06:22 PM
Toggle = 0
SetTimer, macro, 2000
^y::
Toggle := !Toggle
return
macro:
If toggle
{
Send, {F1}
Sleep 500
Click
}
returnBut I recommend you read the tutorials, Autohotkey language is really simple and you should be capable of making these scripts with ease after reading it.
#4
Posted 13 April 2012 - 06:45 PM
#5
Posted 13 April 2012 - 06:49 PM
Try using other send methods (sendevent, sendinput, sendplay)Thank you, it works, but sadly not in the game.
#6
Posted 13 April 2012 - 06:51 PM
You should change the Send method.
Try with Sendplay instead of Send.
Also you should try with ControlSend, or holding the key (logically) por a while.
I leave you an example of the last one:
If toggle
{
Send, {F1 down}
Sleep, 100
Send, {F1 up}
Sleep 500
Click down
Sleep, 100
Click up
}
#7
Posted 13 April 2012 - 07:00 PM
#8
Posted 13 April 2012 - 07:20 PM
Sendevent, Sendinput, Sendplay, ControlSend, everything does not work. It just keeps working on desktop, but not in the Game.
AHK does not work in all the games.
ControlSend didn't work either?
Are you using it correctly?
Please, check the documentation of ControlSend.
If does not work, please, leave us your code.
#9
Posted 13 April 2012 - 08:22 PM
#10
Posted 13 April 2012 - 08:50 PM
I actually don't understand a word about the ControlSend. I think I am just too stupid.
Or you are just not trying.
Controlsend, unlikely other send ways, sends keypresses directly to a program/aplication.
So you have to specify which program/aplication you want to send the Key.
Try this one:
Settitlematchmode 2
ControlSend,, {F1}, Title of the window of the game
The parameter "Title of the window of the game" should be replaced with the actual title of the window of the game.
The settitlematchmode 2 allows you to just write part of the title, and not the whole.
For example.. if window's name is "World of Warcraft", you could write
Settitlematchmode 2
ControlSend,, {F1}, Warcraft
#11
Posted 13 April 2012 - 09:05 PM
Toggle = 0
SetTimer, macro, 2000
^y::
Toggle := !Toggle
return
macro:
If toggle
{
ControlSend,, {F1}, Ragnarok
Sleep 500
Click
}
returnEdit: I was told that my game has to be in window mode and that there is a problem with the solution. Is that right?
#12
Posted 14 April 2012 - 06:41 PM
#13
Posted 15 April 2012 - 03:07 PM
#14
Posted 15 April 2012 - 03:25 PM
#15
Posted 15 April 2012 - 05:02 PM
I just don't understand why it doesn't work. I mean I just want to simulate my keys.




