Run label in another ahk Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Pilu
Posts: 84
Joined: 22 Jun 2018, 01:13

Run label in another ahk

29 Aug 2019, 04:24

Hi,

I have two ahk script how can i run the secound script label from the first script?
What are the options?
wolf_II
Posts: 2688
Joined: 08 Feb 2015, 20:55

Re: Run label in another ahk  Topic is solved

29 Aug 2019, 06:39

One way would be to "RemoteControl" Second.ahk from inside First.ahk, using onMessage() and SendMessage

Example:

Code: Select all

;  First.ahk

DetectHiddenWindows, On
SendMessage, 12345,,,, R:\Temp\Second.ahk ; this remotely controls a script

Code: Select all

;  Second.ahk

OnMessage(12345, "RemoteControl")
return ; end of auto-execute section



;-------------------------------------------------------------------------------
Foo: ; some label
;-------------------------------------------------------------------------------
    MsgBox,, %A_LineFile%, Line %A_LineNumber%: %A_ThisLabel%
return



;-------------------------------------------------------------------------------
RemoteControl() { ; remote control this script
;-------------------------------------------------------------------------------
    goSub Foo
}
I hope my simple example helps you to get started.
Pilu
Posts: 84
Joined: 22 Jun 2018, 01:13

Re: Run label in another ahk

30 Aug 2019, 04:14

Thanks your help @wolf_II It worked :)

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Chunjee and 209 guests