Hi
Using the ControlClick function, it is possible to click a button from an open application, if I can find the ClassNN or name/text of the button in Window Spy. But is it possible to do it the way around? I would like to activate a script when a specific button is activated in another program.
Other ideas would be to create a transparent button on top of the other button that ControlClicks and activates my scirpt, or, as the button briefly changes color, when clicked I could use PixelGetColor. Any other ideas?
best regards Thomas
Monitor if button from app is pushed Topic is solved
Re: Monitor if button from app is pushed
Hallo,
try:Beep when you click the edit1 control of the editor.
try:
Code: Select all
Run, Notepad.exe
WinWait, ahk_exe Notepad.exe
NotepadEdit := WinActive("ahk_exe Notepad.exe") "Edit1"
Return
~*LButton::
MouseGetPos ,,, OutputVarWin, OutputVarControl ;, Flag
IF (NotepadEdit = OutputVarWin OutputVarControl)
SoundBeep, 4000, 20
Return
Re: Monitor if button from app is pushed
I think you are sending a beep everytime you activate the window? Unfortunately it doesnt seem to work when it´s a button in an application. I will try to explain further:Rohwedder wrote: ↑20 Apr 2021, 09:42Hallo,
try:Beep when you click the edit1 control of the editor.Code: Select all
Run, Notepad.exe WinWait, ahk_exe Notepad.exe NotepadEdit := WinActive("ahk_exe Notepad.exe") "Edit1" Return ~*LButton:: MouseGetPos ,,, OutputVarWin, OutputVarControl ;, Flag IF (NotepadEdit = OutputVarWin OutputVarControl) SoundBeep, 4000, 20 Return
From WindowSpy, in visible Text, I can see "Indstillinger" which is a button in the program in lower right corner (translates to settings in danish). I can send do a "ControlClick, Indstillinger, KEYPOINT.NET 2.32" and "Indstillinger" is clicked. Can you manipulate your code so you send a SoundBeep when I manually click the "Indstillinger" button?
Re: Monitor if button from app is pushed Topic is solved
Try:For testing only, the Tooltip shows target and actual
Code: Select all
Control = WindowsForm10.Windows.8.app.0.33c0d9d13 ;target
Return
~*LButton::
MouseGetPos,,,, OutputVarControl ;actual
ToolTip,% Control "`n" OutputVarControl
SetTimer, RemoveToolTip , -3000
IF (OutputVarControl = Control)
SoundBeep, 4000, 20
Return
RemoveToolTip:
ToolTip
Return
Who is online
Users browsing this forum: Descolada, Google [Bot], mmflume, windfancy3 and 133 guests