eManF Posted January 18, 2012 Share Posted January 18, 2012 SimpleCode to Change Caret of SciTE Editor.(AutoIt Editor). I wrote this code cuz SciTEConfig cant change Caret Color.(or i cant find it) I hope be useful. Help: Ctrl + Shift + R --> Run. Ctrl + Shift + Q --> Exit. expandcollapse popup; #INDEX# ======================================================================================================================= ; Title .........: SciTE Caret Changer(Color and Width) ; Language ......: English ; Description ...: SimpleCode to Change Caret of SciTE Editor.(AutoIt Editor) ; Author(s) .....: eManF ; Dll ...........: user32.dll ; =============================================================================================================================== ;--- InClude <scintilla.h.au3> converted to au3 format by lokster --; ;(Simple); ;{ Global $user32 = DllOpen("user32.dll") Global Const $SCI_SETCARETFORE=2069 Global Const $SCI_GETCARETFORE=2138 Global Const $SCI_SETCARETWIDTH=2188 Global Const $SCI_GETCARETWIDTH=2189 ;} ;### You can change these ### ;{ Global $iColor = 0x000000 ;---> CaretColor. 0x000000 = Black. Global $iWidth = 1 ;---> CaretWidth. Can be 0-3(0 = hide). ;} $iSci = ControlGetHandle("[CLASS:SciTEWindow]","","Scintilla1") ;---> Get SciT Handle HotKeySet("^+r","iCaretSet") ;---> Set HotKey(Ctrl+Shift+r) For Run HotKeySet("^+q","iExit") ;---> Set HotKey(Ctrl+Shift+q) For Exit While 1 Sleep(50) WEnd Func iCaretSet() AdlibUnRegister("__CaretSet") AdlibRegister("__CaretSet", 1000) EndFunc Func __CaretSet() If Sci_CaretGetColor($iSci) <> $iColor Or Sci_CaretGetWidth($iSci) <> $iWidth Then Sci_CaretSetWidth($iSci, $iWidth) Sci_CaretSetColor($iSci, $iColor) EndIf EndFunc Func iExit() DllClose($user32) Exit EndFunc ;--- InClude <_SciLexer.au3> By Kip --; ;(Simple); ;{ Func Sci_CaretSetColor($Sci, $iColor) Return SendMessage($Sci, $SCI_SETCARETFORE, $iColor, 0) EndFunc Func Sci_CaretGetColor($Sci) Return SendMessage($Sci, $SCI_GETCARETFORE, 0, 0) EndFunc Func Sci_CaretSetWidth($Sci, $iWidth) Return SendMessage($Sci, $SCI_SETCARETWIDTH, $iWidth, 0) EndFunc Func Sci_CaretGetWidth($Sci) Return SendMessage($Sci, $SCI_GETCARETWIDTH, 0, 0) EndFunc Func SendMessage($hwnd, $msg, $wp, $lp) Local $ret $ret = DllCall($user32, "long", "SendMessageA", "long", $hwnd, "int", $msg, "int", $wp, "int", $lp) If @error Then SetError(1) Return 0 Else SetError(0) Return $ret[0] EndIf EndFunc ;==>SendMessage ;}SciTE Caret Changer(Color and Width).au3 Link to comment Share on other sites More sharing options...
eManF Posted January 19, 2012 Author Share Posted January 19, 2012 (What is this code?)look this: Link to comment Share on other sites More sharing options...
iAmNewbe Posted September 26, 2016 Share Posted September 26, 2016 I was looking for the samething, how to change the color of the caret because on black background it disappears. In the Options -> Open User Options File add the following line somewhere. caret.fore=#FFFFFF This changes the caret to white, I suggest NOT using white because on white backgrounds the carets can't be seen instead I use #8C8C8C for the color but you can choose anything you want it does not have to be just black or white. Width can be changed by using caret.width=1 Might depend on your chosen font for me anything less than 4 gives a thin caret anything 4 or more gives a thicker caret, seems to be only two modes thin or thick at least on my setup. 1 == Thin, 4 == Thick I did not try the script by eManF above, apparently the fore and width option is built-in to Scite, just not written down anywhere I can find even in the help. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now