Herhangi bir Ahk Kodunun bir kısmını Çalıştırmak İçin Tüm Tuş Kombinasyonları için Windows Sisteminizde, DoubleClicks veya MultiClicks'te (Hotkeys cc: :) - ve aynı zamanda (HotkeyStrings: *: cv: :) için de kullanabilirsiniz. Komut Dosyasını bir litte bitini değiştirebilir.
Bu iki Autohotkey Komut Dosyası ile bunu yapabilirsiniz.
- 1: Otomatik Tüm Tuş Kombinasyonlarınızı Tek Bir Windows Kayıt Defteri Anahtarına Kopyalar. (Bunu Arka Planda çalıştırabilirsiniz)
- 2: Daha sonra, yalnızca bu Kayıt Defteri anahtarındaki String değerini kullanın ve Herhangi bir şey yapmak için Kodlar yazın. (Not - Bu Basit Örnek Komut Dosyası, tüm Klavye ve Fare Hareketlerinizi Ekranda Gösterecek - ve DoubleClick tuşlarını kullanarak Ctrl + (2x) c veya MultiClicks 3x tuşlarını kullanarak deneyebilirsiniz)
HKEY_CURRENT_USER,software\GetKeypressValue,KeypressValue
DoubleClicks > if(KeypressValue="Ctrl + c, c")
veya
MultiClicks > if(KeypressValue="Ctrl + c (3)")
2 - Diğer Dillerden Senaryo Yazabilirsin. (sadece o Tek Kayıtlı Anahtar'a erişmeniz gerekir.)
- Microsoft Visual Studio
- Visual Basic
- Turbo Pascal
- Delphi Dilleri
C ++
Python Dilleri
2 - DoubleClickForAllKeystrokes.ahk
; [^ = Ctrl] [! = Alt] [+ = Shift] [# = Win]
; Press <esc> key to exit
; Press <f1> key to toggle between [Scan Pause] & [Scan]
#SingleInstance force
Gui, +AlwaysOnTop -MaximizeBox ;
Gui, Add, Text, center y10 h50 w300 vVar, %KeypressValue%
Gui, Color, White
Gui, show
size=20
Gui, Font, s%size%
GuiControl, Font, var
Doloop=1
MainLanguages=us ; United States
TransLationTo=nl ; Dutch
GroupAdd, Browser, ahk_class Chrome_WidgetWin_1 ; Chrome or Iron
GroupAdd, Browser, ahk_class IEFrame ; Internet Explorer
GroupAdd, Browser, ahk_class MozillaWindowClass ; FireFox
GroupAdd, Browser, ahk_class ApplicationFrameWindow ; Edge
While Doloop=1
{
RegRead, KeypressValue, HKEY_CURRENT_USER,software\GetKeypressValue,KeypressValue ; read KeypressValue
If not GetKeyState("Ctrl","P") and not GetKeyState("Alt","P") and not GetKeyState("LWin","P") and not GetKeyState("RWin","P")
{
;Note - All these Keystrokes will be execute after Release All the keys!
;OneClick {Ctrl}+1x(c) - Copy Is the Default
;if (KeypressValue="Ctrl + c") ;use this for [1x=Ctrl + c][2x=Ctrl + c, c][3x=Ctrl + c (3)] [and many more]
;{
; Here you can put any Code. (Part 1)
; WriteReg_KeypressValue("OneClick - Is the Default Not Needed")
;}
;DoubleClick {Ctrl}+2x(c) - Copy + Google Search
if (KeypressValue="Ctrl + c, c") ;use this for [1x=Ctrl + c][2x=Ctrl + c, c][3x=Ctrl + c (3)] [and many more]
{
;Here you can put any Code. (Part 2)
;sendinput ^c ;Not needed comes from default. (OneClick)
WriteReg_KeypressValue("2x-Google Search")
If WinActive("ahk_group Browser")
{
sendinput ^c ;copy the selected text to clipboard memory
sleep 150
sendinput ^t ; CTRL+t make a new tab + goto address bar - use CTRL+L for the active tab + goto address bar
sleep 150
texta = https://www.google.com/search?q=
textb = %clipboard% ;selected text
textc = &lr=lang_%MainLanguages%&hl=%MainLanguages%&num=100 ; google parameters
clipboard=%texta%%textb%%textc%
sleep 150
sendinput ^v ; paste the selected text
sleep 250
send {enter}
clipboard=%textb%
} else {
sendinput ^c ;copy the selected text to clipboard memory
sleep 150
texta = https://www.google.com/?gfe_rd=cr&gws_rd=cr#q=
textb = %clipboard% ;selected text
textc = &lr=lang_%MainLanguages%&hl=%MainLanguages%&num=100 ; google parameters
clipboard=%texta%%textb%%textc%
run %clipboard%
clipboard=%textb%
}
}
;TripleClicks {Ctrl}+3x(c) - Copy + WikiPedia Search
if (KeypressValue="Ctrl + c (3)") ;use this for [1x=Ctrl c][2x=Ctrl c, c][3x=Ctrl c (3)] [and many more]
{
;Here you can put the Code For (Part 3)
;sendinput ^c ;Not needed comes from default. (OneClick)
WriteReg_KeypressValue("3x-Wiki Search")
If WinActive("ahk_group Browser")
{
sendinput ^c ;copy the selected text to clipboard memory
sleep 150
sendinput ^t ; CTRL+t make a new tab + goto address bar - use CTRL+L for the active tab + goto address bar
sleep 150
texta = https://en.wikipedia.org/wiki/
textb = %clipboard% ;selected text
clipboard=%texta%%textb%
sleep 150
sendinput ^v ; paste the selected text
sleep 250
sendinput {enter}
clipboard=%textb%
} else {
sendinput ^c ;copy the selected text to clipboard memory
sleep 150
texta = https://en.wikipedia.org/wiki/
textb = %clipboard% ;selected text
clipboard=%texta%%textb%
run %clipboard%
clipboard=%textb%
}
}
;MultiClicks {Ctrl}+4x(c) - Copy + Translate Text
if (KeypressValue="Ctrl + c (4)") ;use this for [1x=Ctrl c][2x=Ctrl c, c][3x=Ctrl c (4)] [and many more]
{
;Here you can put the Code For (Part 4)
;sendinput ^c ;Not needed comes from default. (OneClick)
WriteReg_KeypressValue("4x-TransLate Text")
If WinActive("ahk_group Browser")
{
sendinput ^c
sleep 150
sendinput ^t ; CTRL+t this will [open a new tab] + goto adress bar
sleep 150
texta = https://translate.google.com/#auto/%TransLationTo%/
textb = %clipboard% ;selected text
clipboard=%texta%%textb%
sleep 150
sendinput ^v ; paste the selected text
sleep 150
sendinput {enter}
clipboard=%textb%
} else {
sendinput ^c ;copy the selected text to clipboard memory
sleep 150
texta = https://translate.google.com/#auto/%TransLationTo%/
textb = %clipboard% ;selected text
clipboard=%texta%%textb%
run %clipboard%
clipboard=%textb%
}
}
} ;End GetKeyState
sleep 50
GuiControl,, var, %KeypressValue%
} ;End Loop
GuiControl,, var, "Scan Pause"
Gui, show
;-----------------------
~esc::exitapp
f1::
If Doloop=1
{
DoLoop := 0
}else{
reload
}
return
;-----------------------
WriteReg_KeypressValue(a)
{
RegWrite, REG_SZ, HKEY_CURRENT_USER,software\GetKeypressValue,KeypressValue,%a% ;clear the KeypressValue
}
1 - KeypressToREG.ahk
; For the Changelog you can look to the Bottom of the code.
; This code works with a getkeyname from a Dllcall (See Bottom Script- by Lexikos)
; KeypressToREG.ahk comes from KeypressOSD.ahk that was Created by Author RaptorX
; you can press the esc key to exit.
#SingleInstance force
#NoEnv
SetBatchLines, -1
ListLines, Off
; Settings
global TransN := 200 ; 0~255
global ShowSingleKey := True
global ShowMouseButton := True
global ShowSingleModifierKey := True
global ShowModifierKeyCount := true
global ShowStickyModKeyCount := false
global DisplayTime := 2000 ; In milliseconds
global GuiPosition := "Bottom" ; Top or Bottom
global FontSize := 50
global GuiHeight := 115
CreateGUI()
CreateHotkey()
pre_prefix := ""
prefix := ""
pre_key := ""
_key := ""
key := ""
return
OnKeyPressed:
try {
key := GetKeyStr()
ShowHotkey(key)
SetTimer, HideGUI, % -1 * DisplayTime
}
return
OnKeyUp:
return
_OnKeyUp:
tickcount_start := A_TickCount
return
CreateGUI() {
global
Gui, +AlwaysOnTop -Caption +Owner +LastFound +E0x20
Gui, Margin, 0, 0
Gui, Color, Black
Gui, Font, cWhite s%FontSize% bold, Arial
Gui, Add, Text, vHotkeyText Center y20
WinSet, Transparent, %TransN%
}
CreateHotkey() {
Loop, 95
{
k := Chr(A_Index + 31)
k := (k = " ") ? "Space" : k
Hotkey, % "~*" k, OnKeyPressed
Hotkey, % "~*" k " Up", _OnKeyUp
}
Loop, 24 ; F1-F24
{
Hotkey, % "~*F" A_Index, OnKeyPressed
Hotkey, % "~*F" A_Index " Up", _OnKeyUp
}
Loop, 10 ; Numpad0 - Numpad9
{
Hotkey, % "~*Numpad" A_Index - 1, OnKeyPressed
Hotkey, % "~*Numpad" A_Index - 1 " Up", _OnKeyUp
}
Otherkeys := "WheelDown|WheelUp|WheelLeft|WheelRight|XButton1|XButton2|Browser_Forward|Browser_Back|Browser_Refresh|Browser_Stop|Browser_Search|Browser_Favorites|Browser_Home|Volume_Mute|Volume_Down|Volume_Up|Media_Next|Media_Prev|Media_Stop|Media_Play_Pause|Launch_Mail|Launch_Media|Launch_App1|Launch_App2|Help|Sleep|PrintScreen|CtrlBreak|Break|AppsKey|NumpadDot|NumpadDiv|NumpadMult|NumpadAdd|NumpadSub|NumpadEnter|Tab|Enter|Esc|BackSpace"
. "|Del|Insert|Home|End|PgUp|PgDn|Up|Down|Left|Right|ScrollLock|CapsLock|NumLock|Pause|sc145|sc146|sc046|sc123"
Loop, parse, Otherkeys, |
{
Hotkey, % "~*" A_LoopField, OnKeyPressed
Hotkey, % "~*" A_LoopField " Up", _OnKeyUp
}
If ShowMouseButton {
Loop, Parse, % "LButton|MButton|RButton", |
Hotkey, % "~*" A_LoopField, OnKeyPressed
}
for i, mod in ["Ctrl", "Shift", "Alt"] {
Hotkey, % "~*" mod, OnKeyPressed
Hotkey, % "~*" mod " Up", OnKeyUp
}
for i, mod in ["LWin", "RWin"]
Hotkey, % "~*" mod, OnKeyPressed
}
ShowHotkey(HotkeyStr) {
WinGetPos, ActWin_X, ActWin_Y, ActWin_W, ActWin_H, A
if !ActWin_W
throw
text_w := (ActWin_W > A_ScreenWidth) ? A_ScreenWidth : ActWin_W
;remove this gui codeline if you want only to Write the Value to Windows registry
;GuiControl, , HotkeyText, %HotkeyStr%
;GuiControl, , HotkeyText, %HotkeyStr%
RegWrite, REG_SZ, HKEY_CURRENT_USER,software\GetKeypressValue,KeypressValue,%HotkeyStr%
HotkeyText :=""
;remove this gui codeline if you want only to Write the Value to Windows registry
;GuiControl, Move, HotkeyText, w%text_w% Center
;GuiControl, Move, HotkeyText, w%text_w% Center
if (GuiPosition = "Top")
gui_y := ActWin_Y
else
gui_y := (ActWin_Y+ActWin_H) - 115 - 50
;remove this gui codeline if you want only to Write the Value to Windows registry
;Gui, Show, NoActivate x%ActWin_X% y%gui_y% h%GuiHeight% w%text_w%
;Gui, Show, NoActivate x%ActWin_X% y%gui_y% h%GuiHeight% w%text_w%
}
GetKeyStr() {
static modifiers := ["Ctrl", "Shift", "Alt", "LWin", "RWin"]
static repeatCount := 1
for i, mod in modifiers {
if GetKeyState(mod)
prefix .= mod " + "
}
if (!prefix && !ShowSingleKey)
throw
key := SubStr(A_ThisHotkey, 3)
if (key ~= "i)^(Ctrl|Shift|Alt|LWin|RWin)$") {
if !ShowSingleModifierKey {
throw
}
key := ""
prefix := RTrim(prefix, "+ ")
if ShowModifierKeyCount {
if !InStr(prefix, "+") && IsDoubleClickEx() {
if (A_ThisHotKey != A_PriorHotKey) || ShowStickyModKeyCount {
if (++repeatCount > 1) {
prefix .= " ( * " repeatCount " )"
}
} else {
repeatCount := 0
}
} else {
repeatCount := 1
}
}
} else {
if ( StrLen(key) = 1 ) {
key := GetKeyChar(key, "A")
} else if ( SubStr(key, 1, 2) = "sc" ) {
key := SpecialSC(key)
} else if (key = "LButton") && IsDoubleClick() {
key := "Double-Click"
}
_key := (key = "Double-Click") ? "LButton" : key
static pre_prefix, pre_key, keyCount := 1
global tickcount_start
if (prefix && pre_prefix) && (A_TickCount-tickcount_start < 300) {
if (prefix != pre_prefix) {
result := pre_prefix pre_key ", " prefix key
} else {
keyCount := (key=pre_key) ? (keyCount+1) : 1
key := (keyCount>2) ? (key " (" keyCount ")") : (pre_key ", " key)
}
} else {
keyCount := 1
}
pre_prefix := prefix
pre_key := _key
repeatCount := 1
}
return result ? result : prefix . key
}
SpecialSC(sc) {
static k := {sc046: "ScrollLock", sc145: "NumLock", sc146: "Pause", sc123: "Genius LuxeMate Scroll"}
return k[sc]
}
; by Lexikos - https://autohotkey.com/board/topic/110808-getkeyname-for-other-languages/#entry682236
GetKeyChar(Key, WinTitle:=0) {
thread := WinTitle=0 ? 0
: DllCall("GetWindowThreadProcessId", "ptr", WinExist(WinTitle), "ptr", 0)
hkl := DllCall("GetKeyboardLayout", "uint", thread, "ptr")
vk := GetKeyVK(Key), sc := GetKeySC(Key)
VarSetCapacity(state, 256, 0)
VarSetCapacity(char, 4, 0)
n := DllCall("ToUnicodeEx", "uint", vk, "uint", sc
, "ptr", &state, "ptr", &char, "int", 2, "uint", 0, "ptr", hkl)
return StrGet(&char, n, "utf-16")
}
IsDoubleClick(MSec = 300) {
Return (A_ThisHotKey = A_PriorHotKey) && (A_TimeSincePriorHotkey < MSec)
}
IsDoubleClickEx(MSec = 300) {
preHotkey := RegExReplace(A_PriorHotkey, "i) Up$")
Return (A_ThisHotKey = preHotkey) && (A_TimeSincePriorHotkey < MSec)
}
HideGUI() {
Gui, Hide
}
~esc::exitapp
;---------------------------------------------
; ChangeLog : v2.22 (2017-02-25) - Now pressing the same combination keys continuously more than 2 times,
; for example press Ctrl+V 3 times, will displayed as "Ctrl + v (3)"
; v2.21 (2017-02-24) - Fixed LWin/RWin not poping up start menu
; v2.20 (2017-02-24) - Added displaying continuous-pressed combination keys.
; e.g.: With CTRL key held down, pressing K and U continuously will shown as "Ctrl + k, u"
; v2.10 (2017-01-22) - Added ShowStickyModKeyCount option
; v2.09 (2017-01-22) - Added ShowModifierKeyCount option
; v2.08 (2017-01-19) - Fixed a bug
; v2.07 (2017-01-19) - Added ShowSingleModifierKey option (default is True)
; v2.06 (2016-11-23) - Added more keys. Thanks to SashaChernykh.
; v2.05 (2016-10-01) - Fixed not detecting "Ctrl + ScrollLock/NumLock/Pause". Thanks to lexikos.
; v2.04 (2016-10-01) - Added NumpadDot and AppsKey
; v2.03 (2016-09-17) - Added displaying "Double-Click" of the left mouse button.
; v2.02 (2016-09-16) - Added displaying mouse button, and 3 settings (ShowMouseButton, FontSize, GuiHeight)
; v2.01 (2016-09-11) - Display non english keyboard layout characters when combine with modifer keys.
; v2.00 (2016-09-01) - Removed the "Fade out" effect because of its buggy.
; - Added support for non english keyboard layout.
; - Added GuiPosition setting.
; v1.00 (2013-10-11) - First release.
;--------------------------------------------