Hello,
I need some help to create an action that will send a copy to clipboard command after clicking an OK button that closes a window. The ClassNN is TButton2.
I was trying with Lbutton as the hotkey, but I can't figure out how to limit the left click to the OK button.
Thank you in advance!
Copy to clipboard after clicking OK
- divanebaba
- Posts: 805
- Joined: 20 Dec 2016, 03:53
- Location: Diaspora
Re: Copy to clipboard after clicking OK
Hi.
Pressing a button is not difficult. Look here.
Sending a value to clipboard is even easy too. You can send a ^c by example SendInput ^c or store the value of a variable by using clipboard := myVariable.
Your code can look like below
As I don't know, from where you will get content to store in clipboard, I can't give reliable support.
Pressing a button is not difficult. Look here.
Sending a value to clipboard is even easy too. You can send a ^c by example SendInput ^c or store the value of a variable by using clipboard := myVariable.
Your code can look like below
Code: Select all
Control, Check, , TButton2, ahk_class ReplaceThisWithYourAHK_ClassOrWindowTitle
clipboard := "" ; make clipboard empty to be able to monitor the content with CLIPWAIT
send ^c
Clipwait, 2 ;
Einfach nur ein toller Typ.
Re: Copy to clipboard after clicking OK
Here's an idea:
Code: Select all
#NoEnv
#SingleInstance force
#Warn
GUI, Add, Button, w100 h200, OK1
GUI, Add, Button, w100 h200, OK2
GUI, Add, Button, w100 h200, OK3
GUI, Show, AutoSize, TEST
i := 0
return
#If MouseGetWinControl("TEST ahk_class AutoHotkeyGUI", "Button2")
~LButton::ToolTip % ++i
#If
MouseGetWinControl(_winTitle:="", _classNN:="") {
MouseGetPos,,, _hWin, _hwnd, 2
ControlGet, _controlID, Hwnd,, % _classNN, % "ahk_id " . WinExist(_winTitle . " ahk_id " . _hWin)
return (_hwnd && (_hwnd = _controlID))
}