What? That rather sounds that your router or the "internet capable devices" had some driver hick-up, but not that the AHK script was the reason. Because the AHK script was not longer running - not even present on your computer - because you reinstalled your OS already before and ultimately removed the AHK script. So, which looping process have you identified without even having the script on your computer and how did you determine it to be the reason? Sounds like voodoo to me.
But hey, AHK is open source. If you can explain with the source code how it screwed up your system or even your router, feel free to do so. I am sure, we will be all very interested about the details.
But what you are describing doesn't show any connection to AHK whatsoever - apart from a coincidence in timing, perhaps...
My answer was overhasty, I thought I had it fixed with capping my fps. In the end it just made the game not looking so laggy, but the high latency lag spikes aren't gone until today. This is not a post to hate on Autohotkey. I ran an almost identical script in Wildstar that worked. The only difference was that my sleep durations were at least 100 and had obviously different windows/process names. I also didn't run it as admin because it was not needed. I later integrated that the script would open and close a Memory Cleaner called CleanMem with Wildstar being opened and closed. I then had to ran it as admin to make it work. It caused lag so I dumped it. The League of Legends related script that I posted here also needed to be run as admin in order to work.
A computer store said that the script is likely causing the problem and spreading bad data via the router. I also noticed the sort of lag on other devices than my pc, but in an eased way. I followed their advice and resetted all windows based devices and my router but it didn't help sadly. I tried my computer with my grandma's internet access (different router/ISP/hometown) and I had the same lags there. My conclusion is that the problem is with my computer and not my ISP/router. I also once got my drivers installed by the said computer store, I wanted to be sure I have the right drivers and didn't cause the problem due to a bad setting.
When I accepted that I probably can't get back to the state where everything worked flawlessly, I used this kind of script again. I was like: "Well it's ****ed up, can't get worse anyways." But it went worse. The first time the lags appeared was also immediately after I ran the script as admin. The problem has to be the script, it is at least involved in the problem. Maybe the problem is the short duration of Sleep 10. However I ended up resetting my pc once again.
Additionally this is what the Riot Support (League of Legends) sent me a while back as information. I translated it into English:
I can see these "little lags":
145 ms * * 184.108.40.206
92 ms 220.127.116.11
84 ms rdsl-mnhm-de80.nw.mediaways.net [18.104.22.168]
You also got problematic connections to Google which isn't normal at all
105 ms 23 ms rdsl-mnhm-de80.nw.mediaways.net [22.214.171.124]