@krys - thank you also, that seems to work very well. I thought the #IfWinActive would only test if d2 was active when the script was fired up, but it seems that it actually converts space to vc only when space is pressed within the d2 window, and it detects each one, which is perfect.
I also added ^F12::ExitApp outside the d2 code so that I can close it with Ctrl+F12. This doesn't interfere with the d2 key assignments and just gives another way to close it. So the whole script is now:
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.
#IfWinActive ahk_class Diablo II
space:: fort()
fort()
{
send v
sleep 25
click right
sleep 25
send b
}
#IfWinActive
^F12::ExitApp
I will also change space to another character since I use space as stand-still and have the other skills assigned to asdqwezxcfvb keys.
Thanks to both for your help with this. It was very worthwhile to learn AHK and it works fantastically well in d2.