ASF will do that.
You can have it idle any game by sending a command.
EDIT: You can set it up so it doesn't start farming immediately when you are running ASF by setting the "Paused" config to "true".
Does it always get flagged as being dangerous to your PC?