; @Author.: Pablo a.k.a Aurbano ; @Date...: 2020-08-09 ; @Update : 2020-08-29 ; @AutoHotKey ver : 1.33 ; ------------- ; Macro main text file for number keypad and function keys ; Symbol -> key ; ! Alt ; + Shift ; ^ Ctrl ; # Win key ; ------------- ; ============================================================== ; this checks on every function keys what is the ; active window, comparing its name with the account ; number above. Only if present, execute the macro script ; ============================================================== TWSUnderMouse() { ; setup TWS Account just for the Macro Software detect if the ; active window is from the TWS App if it is not the Macro ; software will exit and normal Function keys of any other ; app will be availabable TWSAccount := "XXXXXXXXXXXX" MouseGetPos,,,WindowUnderMouse WinGetTitle, Title, ahk_id %WindowUnderMouse% IfInString, Title, %TWSAccount% return true Else Exit } ; ========================================================= ; section for function keys that works inside TWS only ; for the record, the macro will be executed over the ; chart or window that is inmediatly under the mouse ; ========================================================= #NoEnv #SingleInstance force SetKeyDelay, 25 F4:: ; (De)activate Histogram TWSUnderMouse() BlockInput, On Send {Click} Sleep, 60 Send !vh BlockInput, Off Return F5:: ; Refresh TWS chart TWSUnderMouse() BlockInput, On Send {Click} Sleep, 60 Send !ve{Enter} BlockInput, Off Return F6:: ; Horizontal line TWSUnderMouse() BlockInput, On Send {Click} Sleep, 60 Send !eh BlockInput, Off Return F7:: ; remove all markdown TWSUnderMouse() BlockInput, On Send {Click} Sleep, 60 Send !er BlockInput, Off Return F8:: ; Fibs TWSUnderMouse() BlockInput, On Send {Click} Sleep, 60 Send !ef BlockInput, Off Return F9:: ; (de)activate charttrader (big charts) TWSUnderMouse() BlockInput, On Send {Click} Sleep, 60 Send !vee{Enter} BlockInput, Off Return F10:: ; (de)activate charttrader (smaller charts) TWSUnderMouse() BlockInput, On Send {Click} Sleep, 60 Send !vd BlockInput, Off Return F11:: ; completed trade marks TWSUnderMouse() BlockInput, On Send {Click} Sleep, 60 Send !v{Down 14}{Enter} BlockInput, Off Return F12:: MouseGetPos,,,WindowUnderMouse WinGetTitle, title, ahk_id %WindowUnderMouse% WinSet, Top,,A MsgBox %title% Return