I would like to know if it's possible to "jump" to script code in another script (.ahk file)?
for example:
Code: Select all
^j::
Run, notepad.exe
;initiate call to type_text.ahk
MsgBox, Done!
return
Code: Select all
^j::
Run, notepad.exe
;initiate call to type_text.ahk
MsgBox, Done!
return
that works. ThanksWalkerOfTheDay wrote:afaik you can use the run command to run the AHK script, just like you did with notepad.
That is new to me. Could you give me an example? (I am pretty new to AutoHotkey)jeeswg wrote:Another idea is that one script uses PostMessage/SendMessage, and the other script handles OnMessage.
Code: Select all
;script1.ahk
q::
DetectHiddenWindows, On
SetTitleMatchMode, 2 ;Contains
if !hWnd := WinExist("\script2.ahk ahk_class AutoHotkey")
return
PostMessage, 0x5555, 1,,, % "ahk_id " hWnd ;WM_COMMAND := 0x111
Sleep, 5000
PostMessage, 0x5555, 2,,, % "ahk_id " hWnd ;WM_COMMAND := 0x111
return
;script2.ahk
OnMessage(0x5555, "MsgMonitor")
MsgMonitor(wParam, lParam, uMsg, hWnd)
{
MsgBox, % wParam " " lParam " " uMsg " " hWnd
Func%wParam%()
}
Func1()
{
MsgBox, % A_ThisFunc
}
Func2()
{
MsgBox, % A_ThisFunc
}
Users browsing this forum: BPet, haomingchen1998, Rohwedder, Tvlao and 159 guests