CordMode lets you specify if the coords system should be from the application or the entire screen.
You can read more about it here:
https://autohotkey.com/docs/commands/CoordMode.htm
You can try:
CoordMode, Mouse, Window
Put this at the first line in you code, above all other code, like this:
Code: Select all
CoordMode, Mouse, Window
~s::
{
Click, 2
sleep, 5000
---SNIP---
You can change the last parameter to one of theese (taken from the link above):
Screen: Coordinates are relative to the desktop (entire screen).
Relative: Coordinates are relative to the active window.
Window [v1.1.05+]: Synonymous with Relative and recommended for clarity.
Client [v1.1.05+]: Coordinates are relative to the active window's client area, which excludes the window's title bar, menu (if it has a standard one) and borders. Client coordinates are less dependent on OS version and theme.