#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.12.0 Author: myName Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here ;#NoTrayIcon #include #include #include HotKeySet("{ESC}", "Terminate") Global $hDLL = DllOpen("user32.dll") Global $scitehandle While 1 $scitehandle = WinGetHandle("[CLASS:SciTEWindow]") While WinExists($scitehandle) While WinActive($scitehandle) if _IsPressed("01", $hDLL) Then $clickDown = InMargin() While _IsPressed("01", $hDLL) Sleep(50) WEnd if $clickDown = True Then $clickRelease = InMargin() if $clickRelease = True Then $controlhandle = ControlGetHandle($scitehandle,"","[CLASS:Scintilla;INSTANCE:1]") ;Scintilla handle $selectionStartPos = _SCISendMessage($controlhandle, 2143) ;selection start $selectionStart = _SCISendMessage($controlhandle, 2166, $selectionStartPos) ;line from position $selectionEndPos = _SCISendMessage($controlhandle, 2145) ;selection end $selectionEnd = _SCISendMessage($controlhandle, 2166, $selectionEndPos) ;line from position if $selectionStart = $selectionEnd or $selectionStart = $selectionEnd - 1 Then $selectedLine = _SCISendMessage($controlhandle, 2009) ;get anchor $selectedLine = _SCISendMessage($controlhandle, 2166, $selectedLine) ;line from position $val = _SCISendMessage($controlhandle, 2046, $selectedLine) ;marker get If BitAND($val, 0x0002) Then _SCISendMessage($controlhandle, 2044, $selectedLine, 1) ;delete marker Else _SCISendMessage($controlhandle, 2043, $selectedLine, 1) ;add marker EndIf ;_SCISendMessage($controlhandle, 2141, $selectionStartPos) ; set caret pos ;Send("{HOME}") EndIf EndIf EndIf EndIf Sleep(50) WEnd Sleep(500) WEnd Sleep(2000) WEnd Func InMargin() $windowpos = WinGetPos($scitehandle) if @error Then Return null $mousepos = MouseGetPos() $controlpos = ControlGetPos($scitehandle, "", "[CLASS:Scintilla;INSTANCE:1]") if @error Then Return null $tabHandle = ControlGetHandle($scitehandle,"","[CLASS:SciTeTabCtrl;INSTANCE:1]") if @error Then Return null $tabVisable = ControlCommand($scitehandle, "", $tabHandle, "IsVisible", "") $tabHeight = 0 If $tabVisable Then $tabPosition = ControlGetPos($scitehandle, "", "[CLASS:SciTeTabCtrl;INSTANCE:1]") if @error Then Return null $tabHeight = $tabPosition[3] EndIf if ($mousepos[0] >= $windowpos[0] + 47 And $mousepos[0] <= $windowpos[0] + 63) Then if ($mousepos[1] >= $windowpos[1] + 76 + $tabHeight And $mousepos[1] <= $windowpos[1] + $controlpos[3] + 82) Then Return True EndIf EndIf Return False EndFunc Func _SCISendMessage($h_hWnd, $i_msg, $wParam = 0, $lParam = 0, $s_t1 = "int", $s_t2 = "int") ;function and idea stolen from Martin Local $ret $ret = DllCall($hDLL, "long", "SendMessageA", "long", $h_hWnd, "int", $i_msg, $s_t1, $wParam, $s_t2, $lParam) Return $ret[0] EndFunc ;==>_SCISendMessage Func Terminate() DllClose($hDLL) Exit EndFunc ;==>Terminate