| View previous topic :: View next topic |
| Author |
Message |
keyboardfreak
Joined: 09 Oct 2004 Posts: 216 Location: Budapest, Hungary
|
Posted: Sat Jun 20, 2009 2:29 pm Post subject: Interaction if two scripts binding the same hotkey |
|
|
I have a script which does something if insert is pressed and necessary condition is satisfied, otherwise it simply sends an insert keypress:
| Code: | $insert::
if (condition)
dostuff
else
send {insert}
return
|
I also have an other script which does something else with the insert key in a similar fashion:
| Code: | $insert::
if (someothercondition)
dosomeotherstuff
else
send {insert}
return
|
According to my tests the script which was started later overrides the hotkey binding of the previous one. Is is possible to send the insert key if the script started first doesn't want to do anything special with it, so that it triggers the hotkey in the other script?
The two scripts are fairly complex and do different things, so merging them is not an option. |
|
| Back to top |
|
 |
Z_Gecko Guest
|
Posted: Sat Jun 20, 2009 2:42 pm Post subject: |
|
|
i might be wrong, but IMHO
if you can produce your desired behavior,
you will end up in an endless loop
as soon as both conditions are false and Insert is pressed.
So it would be better to change the logic of your scripts.
Would it harm if both scripts would send Insert on any conditions?
like | Code: |
~Insert::
if (condition)
dostuff
return |
|
|
| Back to top |
|
 |
keyboardfreak
Joined: 09 Oct 2004 Posts: 216 Location: Budapest, Hungary
|
Posted: Sat Jun 20, 2009 2:50 pm Post subject: |
|
|
| Z_Gecko wrote: | | Would it harm if both scripts would send Insert on any conditions? |
Yep, e.g. it would toggle annoyingly insert/overwrite if the current window is an editor.  |
|
| Back to top |
|
 |
Z_Gecko Guest
|
Posted: Sat Jun 20, 2009 3:00 pm Post subject: |
|
|
| sorry, then you must probably rethink your logic. |
|
| Back to top |
|
 |
|