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:
Code: Select all
#IfWinActive ahk_exe firefox.exe
PRINTSCREEN::
{
; Send a Pause command to another script.
DetectHiddenWindows, On
WM_COMMAND := 0x111
ID_FILE_PAUSE := 65403
PostMessage, WM_COMMAND, ID_FILE_PAUSE,,, [PATH]\Script.ahk ahk_class AutoHotkey
DetectHiddenWindows, Off
}
return
SetTitleMatchMode RegEx
:::)::[UTF-SMILEY]
SetTitleMatchMode RegEx will never be executed and will therefore have no effect. See
the top of the script.
However, I see no reason to use
SetTitleMatchMode RegEx 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,
PATH\\Script.ahk (double each slash) or
\QPATH\Script.ahk\E (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
i) to make it case-insensitive, but it is probably better to override the default mode within the hotkey (below
PRINTSCREEN:: but above
PostMessage):
SetTitleMatchMode 1 (or 2).
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.