This is the very top of my script:
Code: Select all
;------------------------------------------------
;---- AUTOHOTKEY KEYBOARD & MOUSE REMAPPING -----
;------------------------------------------------
GET_SELECTED_TEXT: ;{
;------------------------------------------------ Clear Clipboard and Selected Text Variable
Clipboard := ""
Global Selected_Text
Selected_Text := ""
;------------------------------------------------ Chrome
If WinActive("ahk_exe chrome.exe"){
Send ^c
ClipWait, 2
If ErrorLevel {
MsgBox, 48, Error, An error occurred while waiting for the clipboard.
Return
}
Selected_Text := Trim(Clipboard)
;- MsgBox % Selected_Text
;------------------------------------------------ ComicRack
} Else If WinActive("ahk_exe ComicRack.exe") {
ControlGet, Selected_Text, Selected,, WindowsForms10.EDIT.app.0.37e3228_r6_ad12, ahk_exe ComicRack.exe
If ErrorLevel {
MsgBox, 48, Error, Missing ControlGet.
Return
}
Selected_Text := Trim(Selected_Text)
;- MsgBox % Selected_Text
;------------------------------------------------ MediaMonkey
} Else If WinActive("ahk_exe MediaMonkey.exe") {
Send ^c
ClipWait, 2
If ErrorLevel {
MsgBox, 48, Error, An error occurred while waiting for the clipboard.
Return
}
Selected_Text := Trim(Clipboard)
;- MsgBox % Selected_Text
;------------------------------------------------ Everything Else
} Else {
WinActive("A")
;- MsgBox % "WinActive: " WinActive("A")
ControlGetFocus, My_Control
If ErrorLevel {
MsgBox, 48, Error, Missing ControlGetFocus.
Return
}
ControlGet, Selected_Text, Selected,, %My_Control%
If ErrorLevel {
MsgBox, 48, Error, Text is NOT selected.
Return
}
Selected_Text := Trim(Selected_Text)
Return
}
return
;}