Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
SetKeyDelay, 10
WinActivate, ahk_exe scummvm.exe
Send {Ctrl down}
Sleep, 10
Send m
Sleep, 10
Send {Ctrl up}
return
Code: Select all
SetKeyDelay, 10
Code: Select all
Sleep, 10
Furthermore, I want this script to run continuously while process ahk_exe scummvm.exe is running, and also monitor to see if ctrl+f10 is pressed. If ctrl+f10 is pressed, the script should send ctrl+m as it does above. How can I achieve this?
Edit, I have this:
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
WinActivate, ahk_exe scummvm.exe
Send {Ctrl down}
Sleep, 10
Send m
Sleep, 10
Send {Ctrl up}
Loop
{
Process, Exist, scummvm.exe
ScummVM = %ErrorLevel% ; Save the value immediately since ErrorLevel is often changed.
^F10::
MsgBox hello
return
} Until ScummVM = 0
return