Given "But when this is active the following isnt working anymore." (and ignoring the very confusing sentence "When I put the above part below the above part it not working but the second part."), I would guess that the full script is this:
will never be executed and will therefore have no effect. See the top of the script
However, I see no reason to use
in either part of this script. It would have no effect on the hotstring, and would cause the opposite of what you said: when the second part is placed above the first part, the PostMessage call would fail. This is because when you use the RegEx mode, literal slashes must be escaped. For example,
(double each slash) or
(surround the full path with \Q and \E).
RegEx is also case-sensitive by default, meaning you must use exactly the same case for the path as is shown in the window's title. You can prefix the regex with
to make it case-insensitive, but it is probably better to override the default mode within the hotkey (below
evilC wrote:Unless the title of the window literally contains the path [...]
Yes, all windows of class "AutoHotkey" by default have a title beginning with the full path of the script. You can see it when you select "Open" from the tray menu or use a command such as ListLines.