In an effort to make the program easier to understand, I added a new form of SendWin just for background DAOC windows. This makes the instructions pretty simple:
-- If your DAOC window is in the foreground, use SendWin.
-- If it's in the background, use SendWinBackgroundDAOC.
-- If SendWinBackgroundDAOC doesn't work quite right, adjust the timing with SetFocusDelay.