Code:
#include <GUIConstantsEx.au3>
#Include <Misc.au3>
Opt('MustDeclareVars', 1)
GUI()
Func GUI()
Global $b1, $dll, $msg
GUICreate("BROADCAST", 300, 300)
GUISetState(@SW_SHOW)
$b1=GUICtrlCreateCheckbox("S",10,10)
While 1
$dll = DllOpen("user32.dll")
$msg = GUIGetMsg()
If $msg = $GUI_EVENT_CLOSE Then ExitLoop
if GUICtrlRead($b1)=$GUI_CHECKED and WinActive("1") And _IsPressed(20, $dll) then
ControlSend("2","","","{space}")
ControlSend("3","","","{space}")
ControlSend("4","","","{space}")
endIf
if GUICtrlRead($b1)=$GUI_CHECKED and WinActive("2") And _IsPressed(20, $dll) then
ControlSend("1","","","{space}")
ControlSend("3","","","{space}")
ControlSend("4","","","{space}")
EndIf
if GUICtrlRead($b1)=$GUI_CHECKED and WinActive("3") And _IsPressed(20, $dll) then
ControlSend("2","","","{space}")
ControlSend("1","","","{space}")
ControlSend("4","","","{space}")
EndIf
if GUICtrlRead($b1)=$GUI_CHECKED and WinActive("4") And _IsPressed(20, $dll) then
ControlSend("2","","","{space}")
ControlSend("1","","","{space}")
ControlSend("3","","","{space}")
EndIf
WEnd
DllClose($dll)
GUIDelete()
EndFunc
So, if a checkbox is checked, window one is open and spacebar is pressed then send the key to all other windows.
Code:
if GUICtrlRead($b1)=$GUI_CHECKED and WinActive("1") And _IsPressed("67", $dll) then
ControlSend("2","","","{NUMPAD7}",0)
ControlSend("3","","","{NUMPAD7}",0)
ControlSend("4","","","{NUMPAD7}",0)
EndIf
if GUICtrlRead($b1)=$GUI_CHECKED and WinActive("2") And _IsPressed("67", $dll) then
ControlSend("1","","","{NUMPAD7}",0)
ControlSend("3","","","{NUMPAD7}",0)
ControlSend("4","","","{NUMPAD7}",0)
EndIf
if GUICtrlRead($b1)=$GUI_CHECKED and WinActive("3") And _IsPressed("67", $dll) then
ControlSend("2","","","{NUMPAD7}",0)
ControlSend("1","","","{NUMPAD7}",0)
ControlSend("4","","","{NUMPAD7}",0)
EndIf
if GUICtrlRead($b1)=$GUI_CHECKED and WinActive("4") And _IsPressed("67", $dll) then
ControlSend("2","","","{NUMPAD7}",0)
ControlSend("3","","","{NUMPAD7}",0)
ControlSend("1","","","{NUMPAD7}",0)
EndIf
if GUICtrlRead($b1)=$GUI_CHECKED and WinActive("1") And _IsPressed("64", $dll) then
ControlSend("2","","","{NUMPAD4}",0)
ControlSend("3","","","{NUMPAD4}",0)
ControlSend("4","","","{NUMPAD4}",0)
EndIf
if GUICtrlRead($b1)=$GUI_CHECKED and WinActive("2") And _IsPressed("64", $dll) then
ControlSend("1","","","{NUMPAD4}",0)
ControlSend("3","","","{NUMPAD4}",0)
ControlSend("4","","","{NUMPAD4}",0)
EndIf
if GUICtrlRead($b1)=$GUI_CHECKED and WinActive("3") And _IsPressed("64", $dll) then
ControlSend("2","","","{NUMPAD4}",0)
ControlSend("1","","","{NUMPAD4}",0)
ControlSend("4","","","{NUMPAD4}",0)
EndIf
if GUICtrlRead($b1)=$GUI_CHECKED and WinActive("4") And _IsPressed("64", $dll) then
ControlSend("2","","","{NUMPAD4}",0)
ControlSend("3","","","{NUMPAD4}",0)
ControlSend("1","","","{NUMPAD4}",0)
EndIf
if GUICtrlRead($b1)=$GUI_CHECKED and WinActive("1") And _IsPressed("61", $dll) then
ControlSend("2","","","{NUMPAD1}",0)
ControlSend("3","","","{NUMPAD1}",0)
ControlSend("4","","","{NUMPAD1}",0)
EndIf
if GUICtrlRead($b1)=$GUI_CHECKED and WinActive("2") And _IsPressed("61", $dll) then
ControlSend("1","","","{NUMPAD1}",0)
ControlSend("3","","","{NUMPAD1}",0)
ControlSend("4","","","{NUMPAD1}",0)
EndIf
if GUICtrlRead($b1)=$GUI_CHECKED and WinActive("3") And _IsPressed("61", $dll) then
ControlSend("2","","","{NUMPAD1}",0)
ControlSend("1","","","{NUMPAD1}",0)
ControlSend("4","","","{NUMPAD1}",0)
EndIf
if GUICtrlRead($b1)=$GUI_CHECKED and WinActive("4") And _IsPressed("61", $dll) then
ControlSend("2","","","{NUMPAD1}",0)
ControlSend("3","","","{NUMPAD1}",0)
ControlSend("1","","","{NUMPAD1}",0)
EndIf
if GUICtrlRead($b1)=$GUI_CHECKED and WinActive("1") And _IsPressed("60", $dll) then
ControlSend("2","","","{NUMPAD0}",0)
ControlSend("3","","","{NUMPAD0}",0)
ControlSend("4","","","{NUMPAD0}",0)
EndIf
if GUICtrlRead($b1)=$GUI_CHECKED and WinActive("2") And _IsPressed("60", $dll) then
ControlSend("1","","","{NUMPAD0}",0)
ControlSend("3","","","{NUMPAD0}",0)
ControlSend("4","","","{NUMPAD0}",0)
EndIf
if GUICtrlRead($b1)=$GUI_CHECKED and WinActive("3") And _IsPressed("60", $dll) then
ControlSend("2","","","{NUMPAD0}",0)
ControlSend("1","","","{NUMPAD0}",0)
ControlSend("4","","","{NUMPAD0}",0)
EndIf
if GUICtrlRead($b1)=$GUI_CHECKED and WinActive("4") And _IsPressed("60", $dll) then
ControlSend("2","","","{NUMPAD0}",0)
ControlSend("3","","","{NUMPAD0}",0)
ControlSend("1","","","{NUMPAD0}",0)
EndIf