There are a few issues with this:
1. It won't find your Notepad window the way you are specifying it unless you add SetTitleMatchMode, 2
2. Change your if statement to "if not ErrorLevel" or "if (ErrorLevel = 0)"
3. You left out the actual x and y characters that need to precede the values in the ControlClick statement. It should be "ControlClick, x%Px% y%Py%, Notepad,, RIGHT, 2, NA"
4. That ControlClick will click relative to that window's coordinates, while you are searching relative to screen coordinates. To click where you actually found the color, try Click, %Px%, %Py%, Right, 2
5. Not sure what you are trying to double-click using the right mouse button. If you are trying to click in the white space of the Notepad window, it is finding the white in its icon in the title bar before it finds the white space in the editing part. When I change the search coordinates to be within the white part of its window, it works in that it brings up the right-click context menu (even though only one click is needed for that, not two). If you want to constrain it to that area, you should first determine the client area of the Notepad window and do your search within that area.
Regarding your question about excluding a region, the only way I would know how is to break it into 4 separate searches that cover the desired areas while leaving out the middle area.