No that is not true because I tested that theory.
It depends on the order in which you load them, nothing to do with filenames..
As did I (again just now) with exactly the result I expected: run 1.ahk first and 2.ahk takes precedence; conversely, run 2.ahk first and 1.ahk takes precedence. There is good reason for this behaviour: When the first script runs, it uses RegisterHotkey. When the second script runs, RegisterHotkey fails (as the hotkey is already registered by the other script) and the script must resort to the keyboard hook, which takes precedence. If both scripts use the keyboard hook (such as when RegisterHotkey fails both times, or ~ or #UseHook are in use), the script which loads last takes precedence as each newly registered keyboard hook is inserted at the beginning of the chain.
I've not seen anything to indicate a script's filename could or would affect the order of precedence of hotkeys.
No, this won't work. It may seem like they're both sent at the same time, but 1 will ALWAYS be sent first.
One key will always be sent (or received/processed) before the other, which is why I answered "No".
It'll still send 1 first even though the time between each press is astronomically small.
My testing has shown that isn't necessarily true. Although the keyboard hooks are invoked in a specific order and necessarily cannot execute simultaneously, that isn't true of hotkey subroutines
(the script part of the hotkey) running in separate processes. I believe the chain of events for two scripts running ~a or similar hotkey is as follows:
[*:o15bf784]You press the key.
[*:o15bf784]Keyboard hook A recognizes the hotkey and fires a message to script A's main thread. It then continues to call the next keyboard hook.
[*:o15bf784]Keyboard hook B recognizes the hotkey and fires a message to script B's main thread. It then returns, allowing Windows to queue the original keyboard message in the target window's message queue.
[*:o15bf784]At some point (possibly but not necessarily during the above), script A's main thread receives its hotkey message and begins running the hotkey subroutine.
[*:o15bf784]As above for script B.
[*:o15bf784]Depending on how Windows schedules processor time for the two processes, script A or script B may finish first. (Understanding this requires some understanding of multithreading
.)It's intentionally vague. On a single-core/single-processor system, only one process can be running at any instant. I think a typical timeslice is around 10ms, which may be more than enough to process the hotkey and send a keystroke. (In other words, the order might appear consistent on those systems.) However, on my dual-core system, the scripts presumably are able to run simultaneously, as indicated by the seemingly random order that the characters appear in the target window. I used the following scripts in this test:
After repeatedly tapping a, I had this:
I don't think you're fully understanding the question.
In my previous post, only the first word was strictly in answer to your question.