Keystroke, mousemove, click , repeat [help needed]

Post gaming related scripts
Ninjagaiden86
Posts: 1
Joined: 03 May 2018, 21:01

Keystroke, mousemove, click , repeat [help needed]

Post by Ninjagaiden86 » 03 May 2018, 21:05

Hey

I know this should be fairly simple macro/script to create, I'm just quite new to AHK so that's why asking.

So if anyone could post a script that keystrokes lets say Q and then moves mouse to X/y position and then clicks mouse, then sleep > Q and moves cursor to X/Y position and mouse click so on.

If you just give me really basic idea I think I can figure the rest out. If you wonder what for, its ArcheAge and I'm tired of single planting huge farms.

Thx in advance!
Qysh
Posts: 143
Joined: 24 Apr 2018, 09:16

Re: Keystroke, mousemove, click , repeat [help needed]

Post by Qysh » 11 May 2018, 09:49

I hope this helps ;)

Code: Select all

delay_between_actions = 50 ; Delay between key and click
press_key = q
move_x = 150
move_y = 150
wait_long = 5000 ; (long) delay after key and click
;######################################## - Optional
toggle_key = f7
exit_key = f5
show_active_status = 1 ; (Does not work in Fullscreen)
;######################################## - Status Options
status_x = 290
status_y = 8
status_size = 16 ; Font size
status_text = AutoFarm ; Displayed Text
status_font =  ; Leqave blank for default
;################################
#NoEnv
#MaxHotkeysPerInterval 99000000
#HotkeyInterval 99000000
#MaxThreadsPerHotkey 255
#KeyHistory 0
ListLines Off
Process, Priority, , A
SetBatchLines, -1
SetKeyDelay, 0, -1
SetMouseDelay, -1
SetDefaultMouseSpeed, 0
SetWinDelay, -1
SetWorkingDir %A_ScriptDir%
SendMode Input
Hotkey, %toggle_key%, toggle_l
Hotkey, %exit_key%, exit
toggled = 0
drawString(status_x, status_y, status_text, 0xff0000, status_size, "", 880000)
return
;################################# - Code
Loop:
Loop
{
	if(toggled == 0)
	{
		break
	}
	else
	{
		Send, %press_key%
		Sleep, %delay_between_actions%
		Click, %move_x%, %move_y%
		Sleep, %wait_long%
	}
}
return

exit:
ExitApp
return

toggle_l:
if(toggled == 0)
{
	toggled = 1
	drawString(status_x, status_y, status_text, 0x00ff00, status_size, "", 008800)
	Goto, Loop
}
else
{
	toggled = 0
	drawString(status_x, status_y, status_text, 0xff0000, status_size, "", 880000)
}
return

drawString(x, y, string, color, size, Font, background)
{
    Gui, 2:destroy
    Gui, 2: -Caption +E0x80000 +LastFound +OwnDialogs +Owner +AlwaysOnTop +E0x20
    Gui, 2:Color, c%background%
    Gui, 2:Font, s%size% q1 c%color%, %Font%
    gui, 2:margin,, 0
    gui, 2:add, text,, %string%
    Gui, 2:Show, y%Y% x%X% NoActivate, ch
    WinSet, TransColor, c%background% 255
}
Rangerbot
Posts: 34
Joined: 02 Mar 2018, 10:33

Re: Keystroke, mousemove, click , repeat [help needed]

Post by Rangerbot » 13 May 2018, 03:45

Code: Select all

Send {q down}
sleep 25                 
click x, y			;clicks while q is pressed
Send {q up}			;then releases

Code: Select all

Send q
sleep 25                 
click x, y			;clicks after q is pressed and released
repeat:

Code: Select all

Loop [n] {
  Send q
  sleep 25                 
  click x, y		;clicks after q is pressed and released
}
'n' is optional and is the number of times the loop will run
alternatively:

Code: Select all

send {q [n]}  ; press 'q' n times
click x, y, n		; clicks n times at x, y
Rangerbot
Posts: 34
Joined: 02 Mar 2018, 10:33

Re: Keystroke, mousemove, click , repeat [help needed]

Post by Rangerbot » 13 May 2018, 03:52

if you choose to use variables
Send, %press_key%
Sleep, %delay_between_actions%
Click, %move_x%, %move_y%
Sleep, %wait_long%
???????
#MaxHotkeysPerInterval 99000000
#HotkeyInterval 99000000
#MaxThreadsPerHotkey 255
Post Reply

Return to “Gaming”