zackrspv Posted June 12, 2009 Share Posted June 12, 2009 The indomitable horizontal scrollbar is pretty annoying Anyone know how to get rid of it? Got mine to remove by sending the following message in the initial sci_style function: SendMessage($Sci, $SCI_SETHSCROLLBAR, 0, 0) -_-------__--_-_-____---_-_--_-__-__-_ ^^€ñ†®øÞÿ ë×阮§ wï†høµ† ƒë@®, wï†høµ† †ïmë, @ñd wï†høµ† @ †ïmïdï†ÿ ƒø® !ïƒë. €×阮 ñø†, bµ† ïñ§†ë@d wï†hïñ, ñ@ÿ, †h®øµghøµ† †hë 맧ëñ§ë øƒ !ïƒë. Link to comment Share on other sites More sharing options...
Andreik Posted July 14, 2009 Share Posted July 14, 2009 (edited) I use old version but something is wrong. After I press ENTER new line start with an TAB I think, isn't from first position. Edited July 14, 2009 by Andreik Link to comment Share on other sites More sharing options...
Kip Posted July 14, 2009 Author Share Posted July 14, 2009 I use old version but something is wrong. After I press ENTER new line start with an TAB I think, isn't from first position.Eerr, what? MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
Zisly Posted August 4, 2009 Share Posted August 4, 2009 Is there any way to disable the preset hotkeys which make strange symbols appear (forgotten name)? Link to comment Share on other sites More sharing options...
ds34 Posted August 4, 2009 Share Posted August 4, 2009 Obviously some folks got it to run in current Autoit version. I am missing plugin.au3 from the includes...and can't find it in the forum as well. Nothing in scriptbreaking section about an plugin.au3 either. Any help available how to get this running in current Autoit version? Thx. Daniel Link to comment Share on other sites More sharing options...
Kip Posted August 6, 2009 Author Share Posted August 6, 2009 Where do you need plugin.au3 for? MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
ds34 Posted August 6, 2009 Share Posted August 6, 2009 (edited) I try to run the SCIlexer example: #include <Plugins.au3> when I comment it out then couple of unknown constants are found: i.e. $PLGN_CONNECT So it appears to be mandatory... So in case this plugin.au3 weren't related to the UDF at all - would you please be so kind and provide an example w/o this include? Regards from 32°C Germany Edited August 6, 2009 by ds34 Link to comment Share on other sites More sharing options...
ProgAndy Posted August 6, 2009 Share Posted August 6, 2009 it is just the example wich needs this include. Here is another one >_< _SciLexer.zip mLipok 1 *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
ds34 Posted August 6, 2009 Share Posted August 6, 2009 @ProgAndy Ahh, thanx a lot. Looks really great. I am mostly interested in folding and I got it running immediately using Sci_SetAnchor($Sci,25) Sci_FoldingHideLines($Sci, 25, 35) Sci_FoldingShowLines($Sci, 25, 35) However, I am missing the small [+]/[-] controls in front of a fold. Do I need to prepare them myself or is this a managed property of the lexer? Link to comment Share on other sites More sharing options...
ProgAndy Posted August 6, 2009 Share Posted August 6, 2009 I never tried to implement folding, so i don't know how. Maybe Kip has an idea >_ *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
Zisly Posted August 7, 2009 Share Posted August 7, 2009 I never tried to implement folding, so i don't know how. Maybe Kip has an idea Thanks for posting your code!I can now disable the stupid preset hotkeys >_< Link to comment Share on other sites More sharing options...
Kip Posted August 7, 2009 Author Share Posted August 7, 2009 However, I am missing the small [+]/[-] controls in front of a fold. Do I need to prepare them myself or is this a managed property of the lexer?Take a look at SCI_SETFOLDFLAGS, espacially the first flag (I think). I haven't tested it yet. MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
Zisly Posted August 10, 2009 Share Posted August 10, 2009 Well this doesn't work for 64 bit >_ Link to comment Share on other sites More sharing options...
IchBistTod Posted August 24, 2009 Share Posted August 24, 2009 (edited) ok i got everything working excet two things. the folding of code and automatically indenting code(like making loops appear indented the same ammount and such. help would be much liked. Edited August 24, 2009 by IchBistTod [center][/center][center]=][u][/u][/center][center][/center] Link to comment Share on other sites More sharing options...
Kip Posted August 24, 2009 Author Share Posted August 24, 2009 About identing: If characters added: Is that character @CRLF? yes: Add $iStatements tabs to the beginning of the new line. $iStatements is a number which increases everytime While, If, Do, Func, etc is found. And decreases everytime EndIf, WEnd, EndFunc is found. Starting at 0 MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
IchBistTod Posted August 24, 2009 Share Posted August 24, 2009 (edited) not working, this is how it ends up while 1 WEnd this is my code $DefaultText = "" $Sci = Sci_CreateEditorAu3($Form1,193, 88, 565, 377) Sci_AddLines($Sci, $DefaultText,0) Sci_AddLines($Sci, $DefaultText,2) Sci_SetAnchor($Sci,25) Sci_FoldingHideLines($Sci, 25, 35) Sci_FoldingShowLines($Sci, 25, 35) (btw it doesnt collapse) and here is code i got from another user in this thread to make an AU3 lexer with yoru newest version using def and api files expandcollapse popup#include-once #include <WindowsConstants.au3> #include <Constants.au3> #include <WinAPI.au3> #include <_SCILexer.au3> Global Const $tagCharacterRange = "long cpMin; long cpMax" Global Const $tagRangeToFormat = _ "hwnd hdc;" & _ ; // The HDC (device context) we print to "hwnd hdcTarget;" & _ ; // The HDC we use for measuring (may be same as hdc) "int rc[4];" & _ ; // Rectangle in which to print "int rcPage[4];" & _ ; // Physically printable page size "long chrg[2]" ; //CharacterRange: Range of characters to print Global Const $tagSCNotification = "hwnd hWndFrom;int IDFrom;int Code;" & _ "int position;" & _ ; // SCN_STYLENEEDED, SCN_DOUBLECLICK, SCN_MODIFIED, SCN_DWELLSTART, SCN_DWELLEND, SCN_CALLTIPCLICK, SCN_HOTSPOTCLICK, SCN_HOTSPOTDOUBLECLICK "int ch;" & _ ;// SCN_CHARADDED, SCN_KEY "int modifiers;" & _ ;// SCN_KEY, SCN_DOUBLECLICK, SCN_HOTSPOTCLICK, SCN_HOTSPOTDOUBLECLICK "int modificationType;" & _ ;// SCN_MODIFIED "ptr text;" & _ ;const char *text ;// SCN_MODIFIED, SCN_USERLISTSELECTION, SCN_AUTOCSELECTION "int length;" & _ ;// SCN_MODIFIED "int linesAdded;" & _ ;// SCN_MODIFIED "int message;" & _ ;// SCN_MACRORECORD "dword wParam;" & _ ;// SCN_MACRORECORD "dword lParam;" & _ ;// SCN_MACRORECORD "int line;" & _ ;// SCN_MODIFIED, SCN_DOUBLECLICK "int foldLevelNow;" & _ ;// SCN_MODIFIED "int foldLevelPrev;" & _ ;// SCN_MODIFIED "int margin;" & _ ;// SCN_MARGINCLICK "int listType;" & _ ;// SCN_USERLISTSELECTION, SCN_AUTOCSELECTION "int x;" & _ ;// SCN_DWELLSTART, SCN_DWELLEND "int y;" ;// SCN_DWELLSTART, SCN_DWELLEND ;~ }; Global Const $SCI_DEFAULTKEYWORDDIR = @ScriptDir & "\Au3Defs\" ;"C:\Programme\AutoIt3\SciTE\Properties\" Global Const $SCI_DEFAULTCALLTIPDIR = @ScriptDir & "\Au3Defs\" ;"C:\Programme\AutoIt3\SciTE\api\" Global Const $SCI_DEFAULTABBREVDIR = @ScriptDir & "\Au3Defs\" ;@UserProfileDir Global $SCI_hlStart, $SCI_hlEnd, $SCI_sCallTip, $SCI_sCallTipFoundIndices, $SCI_sCallTipSelectedIndice, $SCI_sCallTipPos Global $SCI_sCallTip_Array[1], $SCI_AUTOCLIST[1], $SCI_ABBREVFILE Func SCI_CreateEditorAu3($hWnd, $X, $Y, $W, $H, $CalltipPath = $SCI_DEFAULTCALLTIPDIR, $KeyWordDir = $SCI_DEFAULTKEYWORDDIR, $AbbrevDir = $SCI_DEFAULTABBREVDIR, $RegisterWM_NOTIFY = True) ; The return value is the hwnd of the window, and can be used for Win.. functions Local $Sci = SCI_CreateEditor($hWnd, $X, $Y, $W, $H) If @error Then Return SetError(1, 0, 0) EndIf SCI_InitEditorAu3($Sci, $CalltipPath, $KeyWordDir, $AbbrevDir) If @error Then Return SetError(2, 0, 0) Else If $RegisterWM_NOTIFY = True Then GUIRegisterMsg(0x4E, "SCI_AU3_WM_NOTIFY") Return $Sci EndIf EndFunc ;==>SCI_CreateEditorAu3 ; Prog@ndy Func SCI_SetText($Sci,$Text) Return SendMessageString($Sci,$SCI_SETTEXT,0,$Text) EndFunc ; Prog@ndy Func SCI_GetTextLen($Sci) Local $iLen = SendMessage($Sci, $SCI_GETTEXT, 0, 0) If @error Then Return SetError(1, 0, 0) Return $iLen EndFunc ;==>SCI_GetTextLen #cs ; changed form SCI_GetLines Func SCI_GetText($Sci) Local $ret, $sText, $iLen, $sBuf $iLen = SendMessage($Sci, $SCI_GETTEXT, 0, 0) If @error Then Return SetError(1,0,"") EndIf $sBuf = DllStructCreate("byte[" & $iLen & "]") If @error Then Return SetError(2,0,"") EndIf $ret = DllCall($user32, "long", "SendMessageA", "long", $Sci, "int", $SCI_GETTEXT, "int", $iLen, "ptr", DllStructGetPtr($sBuf)) If @error Then Return SetError(3,0,"") EndIf $sText = BinaryToString(DllStructGetData($sBuf, 1)) $sBuf = 0 If @error Then Return SetError(4,0,"") Else Return $sText EndIf EndFunc #ce ; Author: Prog@ndy Func SCI_GetTextRange($Sci, $start, $end) If $start > $end Then Return SetError(1, 0, "") Local $textRange = DllStructCreate($tagCharacterRange & "; ptr TextPtr; char Text[" & $end - $start + 1 & "]") DllStructSetData($textRange, 1, $start) DllStructSetData($textRange, 2, $end) DllStructSetData($textRange, 3, DllStructGetPtr($textRange, 4)) SendMessage($Sci, $SCI_GETTEXTRANGE, 0, DllStructGetPtr($textRange)) Return DllStructGetData($textRange, "Text") EndFunc ;==>SCI_GETTEXTRANGE ; Changed by Prog@ndy Func SCI_GetCurrentWordEx($Sci, $onlyWordCharacters = 1, $CHARADDED = 0) Local $CurrentPos = SCI_GetCurrentPos($Sci) $CurrentPos -= ($CHARADDED = True) Return SCI_GetWordFromPos($Sci, $CurrentPos, $onlyWordCharacters) EndFunc ;==>SCI_GetCurrentWordEx ; Author: Prog@ndy Func SCI_GetWordPositions($Sci, $CurrentPos, $onlyWordCharacters = 1) Local $Return[2] = [-1, -1] $Return[0] = SendMessage($Sci, $SCI_WORDSTARTPOSITION, $CurrentPos, $onlyWordCharacters) $Return[1] = SendMessage($Sci, $SCI_WORDENDPOSITION, $CurrentPos, $onlyWordCharacters) Return $Return EndFunc ;==>SCI_GetWordPositions ; Author: Prog@ndy Func SCI_GetWordFromPos($Sci, $CurrentPos, $onlyWordCharacters = 1) ;~ Local $Return, $i, $Get, $char ;~ Local $CurrentPos = SCI_GetCurrentPos($Sci) ;~ $CurrentPos -= ($CHARADDED = True) Local $start = SendMessage($Sci, $SCI_WORDSTARTPOSITION, $CurrentPos, $onlyWordCharacters) Local $end = SendMessage($Sci, $SCI_WORDENDPOSITION, $CurrentPos, $onlyWordCharacters) Return SCI_GETTEXTRANGE($Sci, $start, $end) EndFunc ;==>SCI_GetWordFromPos ;modified by Prog@ndy Func SCI_InitEditorAu3($Sci, $CalltipPath = $SCI_DEFAULTCALLTIPDIR, $KeyWordDir = $SCI_DEFAULTKEYWORDDIR, $AbbrevDir = $SCI_DEFAULTABBREVDIR) If $CalltipPath = "" Or $CalltipPath = Default Or IsNumber($CalltipPath) Then $CalltipPath = $SCI_DEFAULTCALLTIPDIR If $KeyWordDir = "" Or $KeyWordDir = Default Or IsNumber($KeyWordDir) Then $KeyWordDir = $SCI_DEFAULTKEYWORDDIR If $AbbrevDir = "" Or $AbbrevDir = Default Or IsNumber($AbbrevDir) Then $AbbrevDir = $SCI_DEFAULTABBREVDIR SendMessage($Sci, $SCI_SETLEXER, $SCLEX_AU3, 0) Local $bits = SendMessage($Sci, $SCI_GETSTYLEBITSNEEDED, 0, 0) SendMessage($Sci, $SCI_SETSTYLEBITS, $bits, 0) SendMessage($Sci, $SCI_SETTABWIDTH, 4, 0) SendMessage($Sci, $SCI_SETINDENTATIONGUIDES, True, 0) ;~ SendMessage($Sci, $SCI_SETZOOM, IniRead(@ScriptDir & "\config.ini", "Settings", "Zoom", -1), 0) Global $SCI_sCallTip_Array = FileRead($CalltipPath & "\au3.api") Local $ExtraAPIs = FileFindFirstFile($CalltipPath & "\au3.*.api") Local $file While 1 $file = FileFindNextFile($ExtraAPIs) If StringRight($SCI_sCallTip_Array, 2) <> @CRLF Then $SCI_sCallTip_Array &= @CRLF $SCI_sCallTip_Array &= FileRead($CalltipPath & $file) If @error Then ExitLoop WEnd If StringRight($SCI_sCallTip_Array, 2) = @CRLF Then StringTrimRight($SCI_sCallTip_Array, 2) FileClose($ExtraAPIs) $SCI_sCallTip_Array = StringSplit($SCI_sCallTip_Array, @CRLF, 1) Global $SCI_AUTOCLIST[UBound($SCI_sCallTip_Array)] = [UBound($SCI_sCallTip_Array) - 1] Local $temp For $i = 1 To $SCI_AUTOCLIST[0] $temp = StringRegExp($SCI_sCallTip_Array[$i], "\A([#@]?\w+)", 1) If Not @error Then $SCI_AUTOCLIST[$i] = $temp[0] Next ArraySortUnique($SCI_AUTOCLIST, 0, 1) Global $SCI_ABBREVFILE = FileRead($AbbrevDir & "\abbrev.properties") Local $SciteKeyWord = FileRead($KeyWordDir & "\au3.keywords.properties") Local $tempText If StringLen($SciteKeyWord) Then $SciteKeyWord = StringRegExpReplace($SciteKeyWord, "(\w)(\r\n)", "$1 $2") $SciteKeyWord = StringSplit($SciteKeyWord, " " & @CRLF, 1) Local $PART ;~ $SCI_AUTOCLIST = "" For $i = 0 To UBound($SciteKeyWord) - 1 $PART = StringLeft($SciteKeyWord[$i], 26) Select Case StringInStr($PART, "au3.keywords.functions=", 0, 1, 1) $tempText = StringReplace(StringTrimLeft($SciteKeyWord[$i], StringLen("au3.keywords.functions=")), "\" & @CRLF, @CRLF) SendMessageString($Sci, $SCI_SETKEYWORDS, 1, $tempText) ConsoleWrite("1" & @CRLF) Case StringInStr($PART, "au3.keywords.udfs=", 0, 1, 1) $tempText = StringReplace(StringTrimLeft($SciteKeyWord[$i], StringLen("au3.keywords.udfs=")), "\" & @CRLF, @CRLF) SendMessageString($Sci, $SCI_SETKEYWORDS, 7, $tempText) ConsoleWrite("2" & @CRLF) Case StringInStr($PART, "au3.keywords.keywords=", 0, 1, 1) $tempText = StringReplace(StringTrimLeft($SciteKeyWord[$i], StringLen("au3.keywords.keywords=")), "\" & @CRLF, @CRLF) SendMessageString($Sci, $SCI_SETKEYWORDS, 0, $tempText) ConsoleWrite("3" & @CRLF) Case StringInStr($PART, "au3.keywords.macros=", 0, 1, 1) $tempText = StringReplace(StringTrimLeft($SciteKeyWord[$i], StringLen("au3.keywords.macros=")), "\" & @CRLF, @CRLF) SendMessageString($Sci, $SCI_SETKEYWORDS, 2, $tempText) ConsoleWrite("4" & @CRLF) Case StringInStr($PART, "au3.keywords.preprocessor=", 0, 1, 1) $tempText = StringReplace(StringTrimLeft($SciteKeyWord[$i], StringLen("au3.keywords.preprocessor=")), "\" & @CRLF, @CRLF) SendMessageString($Sci, $SCI_SETKEYWORDS, 4, $tempText) ConsoleWrite("5" & @CRLF) Case StringInStr($PART, "au3.keywords.special=", 0, 1, 1) $tempText = StringReplace(StringTrimLeft($SciteKeyWord[$i], StringLen("au3.keywords.special=")), "\" & @CRLF, @CRLF) SendMessageString($Sci, $SCI_SETKEYWORDS, 5, $tempText) ConsoleWrite("6" & @CRLF) Case StringInStr($PART, "au3.keywords.sendkeys=", 0, 1, 1) $tempText = StringReplace(StringTrimLeft($SciteKeyWord[$i], StringLen("au3.keywords.sendkeys=")), "\" & @CRLF, @CRLF) SendMessageString($Sci, $SCI_SETKEYWORDS, 3, $tempText) ConsoleWrite("7" & @CRLF) Case Else $tempText = Ptr(123456) EndSelect ;~ If Not IsPtr($tempText) Then $SCI_AUTOCLIST &= $tempText & " " Next EndIf $tempText = "" Local $SciteKeyWord = FileRead($KeyWordDir & "\au3.keywords.abbreviations.properties") If StringLen($SciteKeyWord) Then $SciteKeyWord = StringRegExpReplace($SciteKeyWord, "(\w)(\r\n)", "$1 $2") $SciteKeyWord = StringSplit($SciteKeyWord, " " & @CRLF, 1) For $i = 0 To UBound($SciteKeyWord) - 1 $PART = StringLeft($SciteKeyWord[$i], 26) Select Case StringInStr($PART, "au3.keywords.abbrev=", 0, 1, 1) $tempText = StringReplace(StringTrimLeft($SciteKeyWord[$i], StringLen("au3.keywords.abbrev=")), "\" & @CRLF, @CRLF) SendMessageString($Sci, $SCI_SETKEYWORDS, 6, $tempText) EndSelect Next EndIf $tempText = "" $SciteKeyWord = "" SendMessage($Sci, $SCI_SETMARGINTYPEN, $MARGIN_SCRIPT_NUMBER, $SC_MARGIN_NUMBER) SendMessage($Sci, $SCI_SETMARGINWIDTHN, $MARGIN_SCRIPT_NUMBER, SendMessageString($Sci, $SCI_TEXTWIDTH, $STYLE_LINENUMBER, "_99999")) SendMessage($Sci, $SCI_SETMARGINWIDTHN, $MARGIN_SCRIPT_ICON, 16) SendMessage($Sci, $SCI_AUTOCSETSEPARATOR, Asc(@CR), 0) SendMessage($Sci, $SCI_AUTOCSETIGNORECASE, True, 0) SetStyle($Sci, $STYLE_DEFAULT, 0x000000, 0xFFFFFF, 10, "Courier New") SendMessage($Sci, $SCI_STYLECLEARALL, 0, 0) SetStyle($Sci, $STYLE_BRACEBAD, 0x009966, 0xFFFFFF, 0, "", 0, 1) SetStyle($Sci, $SCE_AU3_DEFAULT, 0x000000, 0xFFFFFF) SetStyle($Sci, $SCE_AU3_COMMENT, 0x339900, 0xFFFFFF) SetStyle($Sci, $SCE_AU3_COMMENTBLOCK, 0x009966, 0xFFFFFF) SetStyle($Sci, $SCE_AU3_NUMBER, 0xA900AC, 0xFFFFFF, 0, "", 1) SetStyle($Sci, $SCE_AU3_FUNCTION, 0xAA0000, 0xFFFFFF, 0, "", 1, 1) SetStyle($Sci, $SCE_AU3_KEYWORD, 0xFF0000, 0xFFFFFF, 0, "", 1) SetStyle($Sci, $SCE_AU3_MACRO, 0xFF33FF, 0xFFFFFF, 0, "", 1) SetStyle($Sci, $SCE_AU3_STRING, 0xCC9999, 0xFFFFFF, 0, "", 1) SetStyle($Sci, $SCE_AU3_OPERATOR, 0x0000FF, 0xFFFFFF, 0, "", 1) SetStyle($Sci, $SCE_AU3_VARIABLE, 0x000090, 0xFFFFFF, 0, "", 1) SetStyle($Sci, $SCE_AU3_SENT, 0x0080FF, 0xFFFFFF, 0, "", 1) SetStyle($Sci, $SCE_AU3_PREPROCESSOR, 0xFF00F0, 0xFFFFFF, 0, "", 0, 0) SetStyle($Sci, $SCE_AU3_SPECIAL, 0xF00FA0, 0xFFFFFF, 0, "", 0, 1) SetStyle($Sci, $SCE_AU3_EXPAND, 0x0000FF, 0xFFFFFF, 0, "", 0, 1) SetStyle($Sci, $SCE_AU3_COMOBJ, 0xFF0000, 0xFFFFFF, 0, "", 1, 1) SetStyle($Sci, $SCE_AU3_UDF, 0xFF8000, 0xFFFFFF, 0, "", 1, 1) SetProperty($Sci, "fold", "1") SetProperty($Sci, "fold.compact", "1") SetProperty($Sci, "fold.comment", "1") SetProperty($Sci, "fold.preprocessor", "1") SendMessage($Sci, $SCI_SETMARGINWIDTHN, $MARGIN_SCRIPT_FOLD, 0); fold margin width=0 SendMessage($Sci, $SCI_MARKERDEFINE, $SC_MARKNUM_FOLDER, $SC_MARK_ARROW) SendMessage($Sci, $SCI_MARKERDEFINE, $SC_MARKNUM_FOLDEROPEN, $SC_MARK_ARROWDOWN) SendMessage($Sci, $SCI_MARKERDEFINE, $SC_MARKNUM_FOLDEREND, $SC_MARK_ARROW) SendMessage($Sci, $SCI_MARKERDEFINE, $SC_MARKNUM_FOLDERMIDTAIL, $SC_MARK_TCORNER) SendMessage($Sci, $SCI_MARKERDEFINE, $SC_MARKNUM_FOLDEROPENMID, $SC_MARK_ARROWDOWN) SendMessage($Sci, $SCI_MARKERDEFINE, $SC_MARKNUM_FOLDERSUB, $SC_MARK_VLINE) SendMessage($Sci, $SCI_MARKERDEFINE, $SC_MARKNUM_FOLDERTAIL, $SC_MARK_LCORNER) SendMessage($Sci, $SCI_SETFOLDFLAGS, 16, 0) SendMessage($Sci, $SCI_MARKERSETFORE, $SC_MARKNUM_FOLDER, 0xFFFFFF) SendMessage($Sci, $SCI_MARKERSETBACK, $SC_MARKNUM_FOLDERSUB, 0x808080) SendMessage($Sci, $SCI_MARKERSETBACK, $SC_MARKNUM_FOLDEREND, 0x808080) SendMessage($Sci, $SCI_MARKERSETFORE, $SC_MARKNUM_FOLDEREND, 0xFFFFFF) SendMessage($Sci, $SCI_MARKERSETBACK, $SC_MARKNUM_FOLDERTAIL, 0x808080) SendMessage($Sci, $SCI_MARKERSETBACK, $SC_MARKNUM_FOLDERMIDTAIL, 0x808080) SendMessage($Sci, $SCI_MARKERSETBACK, $SC_MARKNUM_FOLDER, 0x808080) SendMessage($Sci, $SCI_MARKERSETFORE, $SC_MARKNUM_FOLDEROPEN, 0xFFFFFF) SendMessage($Sci, $SCI_MARKERSETBACK, $SC_MARKNUM_FOLDEROPEN, 0x808080) SendMessage($Sci, $SCI_MARKERSETFORE, $SC_MARKNUM_FOLDEROPENMID, 0xFFFFFF) SendMessage($Sci, $SCI_MARKERSETBACK, $SC_MARKNUM_FOLDEROPENMID, 0x808080) SendMessage($Sci, $SCI_SETMARGINSENSITIVEN, $MARGIN_SCRIPT_FOLD, 1) SendMessage($Sci, $SCI_CLEARCMDKEY, BitShift($SCMOD_CTRL, -16) + 0x47, 0); Ctrl + G SendMessage($Sci, $SCI_CLEARCMDKEY, BitShift($SCMOD_CTRL, -16) + 0x4E, 0); Ctrl + N SendMessage($Sci, $SCI_CLEARCMDKEY, BitShift($SCMOD_CTRL, -16) + 0x4F, 0); Ctrl + O SendMessage($Sci, $SCI_CLEARCMDKEY, BitShift($SCMOD_CTRL, -16) + 0x53, 0); Ctrl + S SendMessage($Sci, $SCI_CLEARCMDKEY, BitShift($SCMOD_CTRL, -16) + 0x46, 0); Ctrl + F SendMessage($Sci, $SCI_MARKERDEFINE, 0, $SC_MARK_SHORTARROW) SendMessage($Sci, $SCI_MARKERDEFINE, 1, $SC_MARK_BACKGROUND) SendMessage($Sci, $SCI_MARKERDEFINE, 2, $SC_MARK_SHORTARROW) SendMessage($Sci, $SCI_MARKERSETBACK, 0, 0x0000FF); error or warning SendMessage($Sci, $SCI_MARKERSETBACK, 1, 0xE6E5FF); error or warning bg colour SendMessage($Sci, $SCI_MARKERSETBACK, 2, 0x03C724); 'mark all' in search win SendMessage($Sci, $SCI_SETMARGINSENSITIVEN, $MARGIN_SCRIPT_FOLD, 1) SendMessage($Sci, $SCI_MARKERSETBACK, 0, 0x0000FF) If @error Then Return 0 Else Return 1 EndIf EndFunc ;==>SCI_InitEditorAu3 Func SCI_AU3_WM_NOTIFY($hWndGUI, $MsgID, $wParam, $lParam) #forceref $hWndGUI, $MsgID, $wParam ;~ Local $tagNMHDR, $event; $tagSCNotification = "int;int;int;int;int;int;int;ptr;int;int;int;int;int;int;int;int;int;int;int" Local $structNMHDR = DllStructCreate("hwnd hWndFrom;int IDFrom;int Code", $lParam) ; tagNMHDR Local $sClassName = DllCall("User32.dll", "int", "GetClassName", "hwnd", DllStructGetData($structNMHDR, 1), "str", "", "int", 512) $sClassName = $sClassName[2] If $sClassName <> "Scintilla" Then Return 'GUI_RUNDEFMSG' $structNMHDR = DllStructCreate($tagSCNotification, $lParam) If @error Then Return 'GUI_RUNDEFMSG' Local $hwndFrom = DllStructGetData($structNMHDR, 1) Local $idFrom = DllStructGetData($structNMHDR, 2) Local $event = DllStructGetData($structNMHDR, 3) Local $position = DllStructGetData($structNMHDR, 4) Local $ch = DllStructGetData($structNMHDR, 5) Local $modifiers = DllStructGetData($structNMHDR, 6) Local $modificationType = DllStructGetData($structNMHDR, 7) Local $char = DllStructGetData($structNMHDR, 8) Local $length = DllStructGetData($structNMHDR, 9) Local $linesAdded = DllStructGetData($structNMHDR, 10) Local $message = DllStructGetData($structNMHDR, 11) Local $uptr_t = DllStructGetData($structNMHDR, 12) Local $sptr_t = DllStructGetData($structNMHDR, 13) Local $Line = DllStructGetData($structNMHDR, 14) Local $foldLevelNow = DllStructGetData($structNMHDR, 15) Local $foldLevelPrev = DllStructGetData($structNMHDR, 16) Local $margin = DllStructGetData($structNMHDR, 17) Local $listType = DllStructGetData($structNMHDR, 18) Local $X = DllStructGetData($structNMHDR, 19) Local $Y = DllStructGetData($structNMHDR, 20) Local $Sci = $hwndFrom If Not IsHWnd($Sci) Then $Sci = HWnd($Sci) ;~ ConsoleWrite("lll" & _WinAPI_GetClassName($Sci) & @CRLF) Local $line_number = SendMessage($Sci, $SCI_LINEFROMPOSITION, $position, 0) ;Select ;Case $hwndFrom = $Sci ;If IsHWnd($Sci) Then Local $Word, $WordPos, $CurrentLine, $PreviousLine, $Tabs, $TabsAdd, $style, $CurrentPos, $pos, $Replace, $AllVariables, $AllVariablesSplit, $AllWords, $err,$Variable Switch $event Case $SCN_CALLTIPCLICK If SendMessage($Sci, $SCI_CALLTIPACTIVE, 0, 0) Then Switch $position Case 1 If IsArray($SCI_sCallTipFoundIndices) And $SCI_sCallTipSelectedIndice > 0 Then $SCI_sCallTipSelectedIndice -= 1 $SCI_sCallTip = Chr(1) & $SCI_sCallTipSelectedIndice + 1 & "/" & UBound($SCI_sCallTipFoundIndices) & Chr(2) & $SCI_sCallTip_Array[$SCI_sCallTipFoundIndices[$SCI_sCallTipSelectedIndice]] $SCI_sCallTip = StringRegExpReplace(StringReplace($SCI_sCallTip,")",")"&@LF,1),"([.:])","$1" & @LF) SendMessageString($Sci, $SCI_CALLTIPSHOW, $SCI_sCallTipPos, $SCI_sCallTip) EndIf Case 2 If IsArray($SCI_sCallTipFoundIndices) And $SCI_sCallTipSelectedIndice < UBound($SCI_sCallTipFoundIndices) - 1 Then $SCI_sCallTipSelectedIndice += 1 $SCI_sCallTip = Chr(1) & $SCI_sCallTipSelectedIndice + 1 & "/" & UBound($SCI_sCallTipFoundIndices) & Chr(2) & $SCI_sCallTip_Array[$SCI_sCallTipFoundIndices[$SCI_sCallTipSelectedIndice]] $SCI_sCallTip = StringRegExpReplace(StringReplace($SCI_sCallTip,")",")"&@LF,1),"([.:])","$1" & @LF) SendMessageString($Sci, $SCI_CALLTIPSHOW, $SCI_sCallTipPos, $SCI_sCallTip) EndIf EndSwitch EndIf Case $SCN_CHARADDED Switch Chr($ch) Case "(" ;~ If Chr($ch) = "(" Then Local $ret, $sText, $iPos = SendMessage($Sci, $SCI_GETCURRENTPOS, 0, 0), $sFuncName Local $iLen = SendMessage($Sci, $SCI_GETCURLINE, 0, 0) Local $sBuf = DllStructCreate("byte[" & $iLen & "]") Local $ret = DllCall($user32, "long", "SendMessageA", "long", $Sci, "int", $SCI_GETCURLINE, "int", $iLen, "ptr", DllStructGetPtr($sBuf)) Local $current = $ret[0] Local $startword = $current While $startword > 0 And StringIsAlNum(Chr(DllStructGetData($sBuf, 1, $startword - 1))) Or Chr(DllStructGetData($sBuf, 1, $startword - 1)) = "_" $startword -= 1 $sFuncName = Chr(DllStructGetData($sBuf, 1, $startword)) & $sFuncName WEnd ;~ $sFuncName = _StringReverse($sFuncName) $SCI_sCallTipFoundIndices = ArraySearchAll($SCI_sCallTip_Array, $sFuncName, 0, 0, 1) $sBuf = 0 $SCI_sCallTipSelectedIndice = 0 $SCI_sCallTip = "" If IsArray($SCI_sCallTipFoundIndices) Then $SCI_sCallTip = Chr(1) & "1/" & UBound($SCI_sCallTipFoundIndices) & Chr(2) & $SCI_sCallTip_Array[$SCI_sCallTipFoundIndices[0]] $SCI_sCallTip = StringReplace(StringRegExpReplace(StringReplace($SCI_sCallTip,")",")"&@LF,1),"(.{70,110} )","$1" & @LF),@LF&@LF,@LF) $SCI_sCallTipPos = $iPos - StringLen($sFuncName) SendMessageString($Sci, $SCI_CALLTIPSHOW, $SCI_sCallTipPos, $SCI_sCallTip) $SCI_hlStart = StringInStr($SCI_sCallTip, "(") $SCI_hlEnd = StringInStr($SCI_sCallTip, ",") SendMessage($Sci, $SCI_CALLTIPSETHLT, $SCI_hlStart, $SCI_hlEnd) EndIf ;~ ElseIf Chr($ch) = "," Then Case "," If SendMessage($Sci, $SCI_CALLTIPACTIVE, 0, 0) Then $SCI_hlStart = $SCI_hlEnd Local $iTemp = StringInStr(StringTrimLeft($SCI_sCallTip, $SCI_hlStart + 1), ",") + $SCI_hlStart If StringInStr(StringTrimLeft($SCI_sCallTip, $SCI_hlStart + 1), ")") + $SCI_hlStart < $iTemp Or $iTemp - $SCI_hlStart = 0 Then $SCI_hlEnd = StringInStr(StringTrimLeft($SCI_sCallTip, $SCI_hlStart + 1), ")") + $SCI_hlStart Else $SCI_hlEnd = $iTemp EndIf SendMessage($Sci, $SCI_CALLTIPSETHLT, $SCI_hlStart, $SCI_hlEnd) EndIf ;~ ElseIf Chr($ch) = ")" Then Case ")" If SendMessage($Sci, $SCI_CALLTIPACTIVE, 0, 0) Then SendMessage($Sci, $SCI_CALLTIPCANCEL, 0, 0) ;~ ElseIf Chr($ch) = @CR Then ; if: enter is pressed / new line created Case @CR $CurrentLine = SCI_GetCurrentLine($Sci) $PreviousLine = SCI_GetLine($Sci, $CurrentLine - 1) $TabsAdd = "" $Tabs = StringSplit($PreviousLine, @TAB) For $i = 1 To $Tabs[0] $TabsAdd &= @TAB Next SCI_AddLines($Sci, $TabsAdd, $CurrentLine) $pos = SCI_GetLineEndPos($Sci, $CurrentLine - 1) SCI_SetCurrentPos($Sci, $pos) Case " " $CurrentPos = SCI_GetCurrentPos($Sci) $style = SendMessage($Sci, $SCI_GETSTYLEAT, $CurrentPos - 2, 0) If $style = $SCE_AU3_EXPAND Then $WordPos = SCI_GetWordPositions($Sci, $CurrentPos - 2) $Replace = StringRegExp($SCI_ABBREVFILE, "(?:\n|\r|\A)" & SCI_GETTEXTRANGE($Sci, $WordPos[0], $WordPos[1]) & "=(.*)", 1) If Not @error Then $Replace = StringFormat(StringRegExpReplace($Replace[0], "\r|\n", "")) SCI_SetSelection($Sci, $WordPos[0], $WordPos[1] + 1) $WordPos[0] += StringInStr($Replace, "|", 1, 1) - 1 If Not StringInStr($Replace, "|", 1, 1) Then $WordPos[0] = $WordPos[1] + 1 SendMessageString($Sci, $SCI_REPLACESEL, 0, StringReplace($Replace, "|", "", 1)) SCI_SetCurrentPos($Sci, $WordPos[0]) EndIf EndIf ;~ ConsoleWrite(SCI_GetWordFromPos($Sci,SCI_GetCurrentPos($Sci)-2) & " - " & $style &":"& $SCE_AU3_EXPAND & @CRLF) ;~ Else Case Else ;~ #CS ; Uncomment this to add autocomplete for variables $style = SendMessage($Sci, $SCI_GETSTYLEAT, SCI_GetCurrentPos($Sci), 0) If Not SendMessage($Sci, $SCI_AUTOCACTIVE, 0, 0) And _ $style <> $SCE_AU3_COMMENT And $style <> $SCE_AU3_COMMENTBLOCK _ And $style <> $SCE_AU3_STRING And $style <> $SCE_AU3_SENT Then $Word = SCI_GetCurrentWordEx($Sci, 0, 1) While $Word And Not StringRegExp($Word, "\A([@$#_]|\w)") $Word = StringTrimLeft($Word, 1) WEnd While $Word And Not StringRegExp($Word, "([@$#_]|\w)\Z") $Word = StringTrimRight($Word, 1) WEnd ;~ ConsoleWrite($Word & @CRLF) If $Word And StringLeft($Word, 1) = "{:content:}quot; Then $AllWords = StringSplit(SCI_GetText($Sci), " []()-+*=/<>," & @CRLF & @TAB) $AllVariables = @CR For $i = 1 To $AllWords[0] ; Get all variables from the script and trim them $Variable = $AllWords[$i] If StringLeft($Variable, 1) = "{:content:}quot; Then If Not StringInStr($AllVariables, @CR & $Variable & @CR) And Not ($Variable = $Word) Then $AllVariables &= $Variable & @CR EndIf EndIf Next $AllVariables = StringTrimLeft($AllVariables, 1) ; remove the first CR $AllVariables = StringTrimRight($AllVariables, 1) ; remove the last CR $AllVariablesSplit = StringSplit($AllVariables, @CR) _ArraySort($AllVariablesSplit, 0, 1) $AllVariables = _ArrayToString($AllVariablesSplit, @CR, 1) SendMessageString($Sci, $SCI_AUTOCSHOW, StringLen($Word), $AllVariables) ElseIf StringLen($Word) Then ;~ If Not SendMessage($Sci, $SCI_AUTOCACTIVE, 0,0) Then ;~ ConsoleWrite($Word & @CRLF) If StringRegExp($Word, "\A[A-Za-z0-9_@#]+\Z") Then ;And StringInStr(@CR & $SCI_AUTOCLIST,@CR & $Word,0) Then Local $pos = ArraySearchAll($SCI_AUTOCLIST, $Word, 1, 0, 1) If $pos = -1 Then Return 'GUI_RUNDEFMSG' ;~ _ArraySort($SCI_AUTOCLIST,0,1) $AllVariables = _ArrayToString($SCI_AUTOCLIST, @CR, $pos[0], $pos[UBound($pos) - 1]) ;~ $AllVariables = _ArrayToString($SCI_AUTOCLIST, @CR,1) ;~ ConsoleWrite($AllVariables & @CRLF) $err = SendMessageString($Sci, $SCI_AUTOCSHOW, StringLen($Word), $AllVariables) ;~ ConsoleWrite($err & @CRLF) EndIf ;~ EndIf EndIf EndIf ;~ #CE ;~ EndIf EndSwitch Case $SCN_MARGINCLICK SendMessage($Sci, $SCI_TOGGLEFOLD, $line_number, 0) Case $SCN_SAVEPOINTREACHED Case $SCN_SAVEPOINTLEFT EndSwitch ;EndIf ;EndSelect $structNMHDR = 0 $event = 0 $lParam = 0 Return 'GUI_RUNDEFMSG' EndFunc ;==>SCI_AU3_WM_NOTIFY ;Prog@ndy, modified _ArraySearch Func ArraySearchAll(Const ByRef $avArray, $vValue, $iStart = 0, $iEnd = 0, $iPartialfromBeginning = 0, $iForward = 1, $iSubItem = 0) If Not IsArray($avArray) Then Return SetError(1, 0, -1) Local $iUBound = UBound($avArray) - 1 ; Bounds checking If $iEnd < 1 Or $iEnd > $iUBound Then $iEnd = $iUBound If $iStart < 0 Then $iStart = 0 If $iStart > $iEnd Then Return SetError(4, 0, -1) If $vValue = "" And $iPartialfromBeginning = True Then Return SetError(8, 0, -1) ; Direction (flip if $iForward = 0) Local $iStep = 1 If Not $iForward Then Local $iTmp = $iStart $iStart = $iEnd $iEnd = $iTmp $iStep = -1 EndIf Local $ResultsArray[$iUBound + 1], $ResultIndex = 0 Local $iLenValue = StringLen($vValue) ; Search Switch UBound($avArray, 0) Case 1 ; 1D array search If Not $iPartialfromBeginning Then For $i = $iStart To $iEnd Step $iStep If $avArray[$i] = $vValue Then $ResultsArray[$ResultIndex] = $i $ResultIndex += 1 EndIf Next Else For $i = $iStart To $iEnd Step $iStep If StringLeft($avArray[$i], $iLenValue) = $vValue Then $ResultsArray[$ResultIndex] = $i $ResultIndex += 1 EndIf Next EndIf Case 2 ; 2D array search Local $iUBoundSub = UBound($avArray, 2) - 1 If $iSubItem < 0 Then $iSubItem = 0 If $iSubItem > $iUBoundSub Then $iSubItem = $iUBoundSub If Not $iPartialfromBeginning Then For $i = $iStart To $iEnd Step $iStep If $avArray[$i][$iSubItem] = $vValue Then $ResultsArray[$ResultIndex] = $i $ResultIndex += 1 EndIf Next Else For $i = $iStart To $iEnd Step $iStep If StringLeft($avArray[$i][$iSubItem], $iLenValue) = $vValue Then $ResultsArray[$ResultIndex] = $i $ResultIndex += 1 EndIf Next EndIf Case Else Return SetError(7, 0, -1) EndSwitch If $ResultIndex = 0 Then Return SetError(6, 0, -1) ReDim $ResultsArray[$ResultIndex] Return $ResultsArray EndFunc ;==>ArraySearchAll ; Author: Prog@ndy ; If the equal entries are one after the other, delete them :) Func ArraySortUnique(ByRef $avArray, $iDescending = 0, $iStart = 0, $iEnd = 0, $iSubItem = 0) Local $ret = _ArraySort($avArray, $iDescending, $iStart, $iEnd, $iSubItem) If @error Then Return SetError(@error, 0, $ret) Local $ResultIndex = 1, $ResultArray[UBound($avArray)] $ResultArray[0] = $avArray[0] For $i = 1 To UBound($avArray) - 1 If Not ($avArray[$i] = $avArray[$i - 1]) Then $ResultArray[$ResultIndex] = $avArray[$i] $ResultIndex += 1 EndIf Next ReDim $ResultArray[$ResultIndex] $avArray = $ResultArray Return 1 EndFunc ;==>ArraySortUnique any suggestions on something i need to change or add? also if i read your above post correctly i need to make some sort of conditional statement in the while loop using the last word entered? how would i detect the last word entered? Edited August 24, 2009 by IchBistTod wuuyi123 1 [center][/center][center]=][u][/u][/center][center][/center] Link to comment Share on other sites More sharing options...
Dolemite50 Posted September 23, 2009 Share Posted September 23, 2009 Hi Kip, Just wanted to say thanks for the great library. ProgAndy, your additions were helpful as well. I'm still trying to get them figured out but I'm finally making some good progress. Hat's off, gents! Link to comment Share on other sites More sharing options...
FuryCell Posted June 12, 2010 Share Posted June 12, 2010 Excellent work. Very useful for what I am coding (another snippet holder). The one thing i did notice is some issues with global vars. I don't see you declaring $X as local as local in WM_NOTIFY. HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code. Link to comment Share on other sites More sharing options...
Kip Posted June 12, 2010 Author Share Posted June 12, 2010 (edited) May I ask which line you are talking about? ;// line 624; Local $X = DllStructGetData($tagNMHDR, 19) Local $Y = DllStructGetData($tagNMHDR, 20) Edited June 12, 2010 by Kip MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
FuryCell Posted June 12, 2010 Share Posted June 12, 2010 (edited) May I ask which line you are talking about? ;// line 624; Local $X = DllStructGetData($tagNMHDR, 19) Local $Y = DllStructGetData($tagNMHDR, 20) I guess its just the old version because that code seems fine. Sorry for the confusion and excellent work. Edited June 12, 2010 by FuryCell HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code. 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