Run action by another macro

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
zoinho
Posts: 6
Joined: 28 Apr 2020, 17:43

Run action by another macro

11 Apr 2021, 17:06

Hello, I'm trying to make a macro to run another macro at the end of a loop (so I won't waste time).

So, the first macro, that will be on loop is the following one:

Code: Select all

#IfWinActive, ahk_exe client.exe
#SingleInstance Force
#UseHook
;Se voce usa CTRL use ^ se usa SHIFT use + antes das chaves
;Ex.: ^{%Ico%}

Mana:= "{F4}"
Utito:= "{F12}"
Gran:= "{F8}"
Exori:= "{F6}"
Min:= "{F7}"
Mas:= "{F9}"
Res:= "{F11}"
Ico:= "{F1}"
[b]Loot:= "{Insert}"[/b]

MButton::

Loop
{
Send %Utito% ;; 10
Sleep, 100
Send %Gran% ;; 10
Sleep, 2100
Send %Exori% ;; 8
Sleep, 2100
Send %Min% ;; 6
Sleep, 2100
Send %Gran% ;; 4
Sleep, 2100
Send %Exori% ;; 2
Sleep, 2100
Send %Min% ;; 
Sleep, 2100
Send %Loot% ;; 
Sleep, 50
}

Escape::
    Reload
    Send, {Esc}
The second one that will be run on the line "Send %Loot%" is the following one, that will run when I press Insert.

Code: Select all

SetBatchLines, -1
SetKeyDelay, -1, -1
SetMouseDelay, -1
SetDefaultMouseSpeed, 0
SetWinDelay, -1
SetControlDelay, -1
SendMode Input
#SingleInstance Force
#IfWinActive, ahk_exe client.exe
#InstallKeybdHook
#UseHook
waitt = 5

`::
Insert::

CordX1 = 903
CordX2 = 970
CordX3 = 1028
CordY1 = 411
CordY2 = 485
CordY3 = 554
{
MouseGetPos x, y
SetDefaultMouseSpeed 0
SetMouseDelay 0
Send {Shift Down}
SendInput {Click %CordX1%, %CordY1%, right}
sleep, %waitt%
SendInput {Click %CordX1%, %CordY2%, right}
sleep, %waitt%
SendInput {Click %CordX1%, %CordY3%, right}
sleep, %waitt%
SendInput {Click %CordX2%, %CordY1%, right}
sleep, %waitt%
SendInput {Click %CordX2%, %CordY2%, right}
sleep, %waitt%
SendInput {Click %CordX2%, %CordY3%, right}
sleep, %waitt%
SendInput {Click %CordX3%, %CordY1%, right}
sleep, %waitt%
SendInput {Click %CordX3%, %CordY2%, right}
sleep, %waitt%
SendInput {Click %CordX3%, %CordY3%, right}
sleep, %waitt%
Send {Shift Up}
MouseMove %x%, %y%
}
Return
But nothing happens, works if I actually press it on my keyboard.

Thanks on advance.
User avatar
mikeyww
Posts: 26848
Joined: 09 Sep 2014, 18:38

Re: Run action by another macro

11 Apr 2021, 19:08

Assuming a single script, instead of Send %Loot%:

Code: Select all

Gosub, Insert
Demo:

Code: Select all

F3::
Send x
Gosub, Insert
Return

Insert::
Send y
Return

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 262 guests