Quick question for AHK experienced users

I am trying to execute a simple command using AutoHotkey. See below.


#IfWinActive,PlayRust

{
    Send {F1}
    Sleep 100
    Send status
    sleep 100
    Send {Enter}
    sleep 100
    Send {F1}
    Sleep 100
}

I ran this test and all it is doing is opening the Windows Help & Support window and not actually doing as I intend it to do which is simply open the console and type a simple command. Anyone know what part I did wrong? Basically I want this command to only work if Rust is open.

Thanks!

Why use autohotkey when you can use JitBit Macro recorder?



(your hotkey here)::
ifwinactive, PlayRust
{
    Send {F1}
    Sleep 100
    Send status
    sleep 100
    Send {Enter}
    sleep 100
    Send {F1}
}
return


this should work

Thanks will this work when the file is executed? Sorry I forgot to mention it must run when the ahk file is executed.

Thanks I’ll test it now!

remove the lines “(your hotkey here)::” and “return” and it will

[editline]1st February 2014[/editline]


ifwinactive, PlayRust
{
    Send {F1}
    Sleep 100
    Send status
    sleep 100
    Send {Enter}
    sleep 100
    Send {F1}
}

like this

I ran this code and nothing happened after clicking the file or right clicking and choosing “run script”. I will do more research in the mean time. Thanks.


IfWinActive,PlayRust

{
	Send {F1}
	Sleep 100
	Send this is a test
	sleep 100
	Send {Enter}
	sleep 100
	Send {F1}
	Sleep 100
}

it only works if the active window’s title is “PlayRust”

replace “IfWinActive” with “WinWaitActive” if you want it to wait for the window

It’s def PlayRust. http://prntscr.com/2onq6z and the game is open.



WinActivate, PlayRust
WinWaitActive, PlayRust
Sleep, 100
Send, {F1}
Sleep, 100
Send, this is a test
sleep, 100
Send, {Enter}
sleep, 100
Send, {F1}


here is some scripts I have if this helps

Random number generator


*ralt:: 
Loop 
{ 
    GetKeyState, raltState, ralt, P 
    If raltState = U 
        break
Sleep 20
Random, Num, 0, 9999
sleep, 5
SendInPut %Num%
Sleep 20
} 
Return

autoclicker will help


*mbutton:: 
Sleep 1
Loop 
{ 
    GetKeyState, mbuttonState, mbutton, P 
    If mbuttonState = U 
        break  
    Sleep 1
    Send, {lbutton} 
} 
Return


Bingo! Thank you sir!

if you want to get serious about macros invest in either Logitech or Razor’