Kip Posted August 18, 2007 Share Posted August 18, 2007 (edited) Title says enough (For those who don't know, scilexer is an editing control, like the one SciTE uses) It now supports multiple editors, and allows you to write your own lexer. Functions: Func Sci_CreateEditor($Hwnd, $X,$Y,$W,$H) Func Sci_DelLines($Sci) Func Sci_AddLines($Sci, $Text,$Line) Func Sci_GetLines($Sci) Func Sci_GetLine($Sci, $Line) Func Sci_InsertText($Sci, $Pos, $Text) Func Sci_GetCurrentPos($Sci) Func Sci_SetCurrentPos($Sci, $Char) Func Sci_GetLineFromPos($Sci, $Pos) Func Sci_GetLineStartPos($Sci, $Line) Func Sci_SetAnchor($Sci, $iPos) Func Sci_SetCurrentPosEx($Sci, $iPos) Func Sci_SetZoom($Sci, $Zoom) Func Sci_GetZoom($Sci) Func Sci_VisibleFirst($Sci) Func Sci_VisibleLines($Sci) Func Sci_GetLineEndPos($Sci, $Line) Func Sci_GetLineLenght($Sci, $Line) Func Sci_GetLineCount($Sci) Func Sci_SetCurrentLine($Sci, $Line) Func Sci_GetCurrentLine($Sci) Func Sci_GetChar($Sci, $Pos) Func Sci_GetCurrentWord($Sci) Func Sci_SetSelection($Sci, $BeginChar, $EndChar) Func Sci_GetSelection($Sci) Func Sci_SetSelectionColor($Sci, $Color, $State=True) Func Sci_SetSelectionBkColor($Sci, $Color, $State=True) Func Sci_SetSelectionAlpha($Sci, $Trans) Func Sci_ReplaceSel($Sci, $sText) Func Sci_SelectAll($Sci) Func Sci_Cut($Sci) Func Sci_Copy($Sci) Func Sci_Paste($Sci) Func Sci_StyleApply($Sci, $iStyle, $iStartPos, $iLenght) Func Sci_StyleSet($Sci, $iStyle, $iColor=-1, $iBkColor=-1, $iBold=-1, $iItalic=-1, $iUnderline=-1, $sFont=-1, $iFontSize=-1) Func Sci_StyleClearAll($Sci) Func Sci_GetStyleAt($Sci, $iPos) Func Sci_SetLexer($Sci, $iLexer) Func Sci_GetLexer($Sci) Sci_CalltipShow($Sci, $iPos, $sText) Sci_CalltipActive($Sci) Sci_CalltipCancel($Sci) Sci_CalltipHighlight($Sci, $iStartPos, $iEndPos) Sci_CalltipPos($Sci) Sci_CallTipSetHltColor($Sci, $iColor) Sci_CallTipSetColor($Sci, $iColor) Sci_CallTipSetBkColor($Sci, $iColor) Sci_AutoCompleteActive($Sci) Sci_AutoCompleteCancel($Sci) Sci_AutoCompleteShow($Sci, $iLen, $sWords) Sci_LineWrapSetMode($Sci, $iMode) Sci_LineWrapSetIndent($Sci, $iMode) Sci_LineWrapSetIndentLocation($Sci, $iLocation) Sci_SetSavePoint($Sci) Sci_GetModify($Sci) Sci_SelectionSetBkColor($Sci, $iColor, $iUse=True) Sci_SelectionSetColor($Sci, $iColor, $iUse=True) Sci_SelectionSetAlpha($Sci, $iAlpha) Sci_SelectionGetAlpha($Sci) Sci_CaretSetColor($Sci, $iColor) Sci_CaretGetColor($Sci) Sci_CaretSetWidth($Sci, $iWidth) Sci_CaretGetWidth($Sci) Sci_FoldingShowLines($Sci, $iStart, $iEnd) Sci_FoldingHideLines($Sci, $iStart, $iEnd) Sci_FoldingToggleFold($Sci, $iLine) Kip Old version (where AutoIt is the standard language) SciLexer.zip New version (which allows you to create your own lexer): _SciLexer.zip I recommend to use the new version Edit: AutoIt now isn't the standard language anymore Edited February 21, 2010 by Kip mLipok 1 MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
James Posted August 18, 2007 Share Posted August 18, 2007 Nice work there kip. You should add an example. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
MerkurAlex Posted September 6, 2007 Share Posted September 6, 2007 I realize this is somewhat of an old topic but anyone know how i could get the line count? [quote name='PsaltyDS' post='635433' date='Jan 27 2009, 07:04 AM']Larry is a mass murderer?! It's always the quiet, clean cut, bald guys... [/quote] Link to comment Share on other sites More sharing options...
GEOSoft Posted September 6, 2007 Share Posted September 6, 2007 I realize this is somewhat of an old topic but anyone know how i could get the line count?Read it to an array and then check array[0] or Ubound(Array)-1 George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
MerkurAlex Posted September 12, 2007 Share Posted September 12, 2007 Read it to an array and then check array[0] or Ubound(Array)-1How about resizing so i can resize my window and it resizes with it i have never played with resizing. [quote name='PsaltyDS' post='635433' date='Jan 27 2009, 07:04 AM']Larry is a mass murderer?! It's always the quiet, clean cut, bald guys... [/quote] Link to comment Share on other sites More sharing options...
ConsultingJoe Posted September 13, 2007 Share Posted September 13, 2007 Great work. A great function to add would be the syntax coloring. Check out ConsultingJoe.com Link to comment Share on other sites More sharing options...
Kip Posted March 21, 2008 Author Share Posted March 21, 2008 (edited) Added 9 new functions and an example, see first post for file and info. Edited March 21, 2008 by kip MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
blitzkrg Posted March 21, 2008 Share Posted March 21, 2008 can someone elaborate on what this is? and what it is used for? I googled and it appears it's part of many software packages, but is till cant seem to figure out what it does and what this could be used for. thanks Link to comment Share on other sites More sharing options...
ByteMyCookies Posted March 21, 2008 Share Posted March 21, 2008 Wow, this is really cool! Question does the get current selecetion return a string or raw text? My Scripts,[topic="65986"]AI Example[/topic] ,Capable of Emotion! Link to comment Share on other sites More sharing options...
Kip Posted March 21, 2008 Author Share Posted March 21, 2008 (edited) can someone elaborate on what this is? and what it is used for?Its a rich-text editing control, like the one that SciTE uses. Question does the get current selecetion return a string or raw text?it returns the first pos and the last pos of the selection. You can use GetLines() and StringMid() to get the text. $Sel = Sci_GetSelection() $Text = Sci_GetLines() $SelectedText = StringMid($Text,$Sel[0]+1,$Sel[1]-$Sel[0]) MsgBox(0,"blabla", $SelectedText) Edited March 21, 2008 by kip MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
NELyon Posted May 21, 2008 Share Posted May 21, 2008 (edited) Bumping because this is such a great UDF, and because I have an issue I began writing a small text editor with syntax highlighting. Here's a little teaser:ClickyBut I noticed that your Sci_Getlines function is extremely slow on even small files. I tried opening a 180 line script I wrote using Sci_AddLines, and worked in a few milliseconds. Now, trying to read this data with Sci_GetLines took about 25 seconds. Is this a known limitation with the SciLexer? SciTe doesn't seem to do this.EDIT: I also updated your syntax files with those from the latest release. I can attach that if you want, someone might want it. Edited May 21, 2008 by KentonBomb Link to comment Share on other sites More sharing options...
Kip Posted May 21, 2008 Author Share Posted May 21, 2008 (edited) Now, trying to read this data with Sci_GetLines took about 25 seconds.I guess it's just you, it takes less than a blink with my eye to get all the lines. EDIT: I also updated your syntax files with those from the latest release. I can attach that if you want, someone might want it.If you want to, it would be great Edit: can you show me how/when you use GetLines() ? Edited May 21, 2008 by Kip MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
NELyon Posted May 21, 2008 Share Posted May 21, 2008 (edited) Here's an excerpt from the exit function:If $sCurrentFile = "" Then Exit Else $sCurrentData = Sci_GetLines() If FileRead($sCurrentFile) <> $sCurrentData Then Switch MsgBox($MB_YESNOCANCEL, "Would you like to save?", "Would you like to save your work?") Case $IDYes FileWrite(FileSaveDialog("Save File", @WorkingDir, "Autoit Scripts (*.au3)"), $sCurrentData) Exit Case $IDNo Exit EndSwitch Else Exit EndIf EndIfObviously you cannot run this example without the GUI, but you see the point.EDIT: Defs for 3.2.12.0: http://ktech.heliohost.org/Defs_3212.zipEDIT2: Hmm. Those drastic times were a result of a bad CPU-Hogging loop I had going on. A 500 Line script does still take at least 8 seconds to read with Sci_GetLines though. It's not nearly as bad, so I can live with it. Edited May 21, 2008 by KentonBomb Link to comment Share on other sites More sharing options...
Kip Posted May 22, 2008 Author Share Posted May 22, 2008 I think it's just you (or not), in my script it uses 0.6 seconds to get 2250 lines. MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
ProgAndy Posted May 22, 2008 Share Posted May 22, 2008 (edited) It should be faster, if you use $sText = BinaryToString(DllStructGetData($sBuf, 1)) instead of ; For $i = 1 To $iLen - 1 ; $sText &= Chr(DllStructGetData($sBuf, 1, $i)) ; Next And in Func Sci_AddLines($Text,$Line) i would use . $LineLenght = StringLen($Text) instead of . $LineLenght = StringSplit($Text,"") Edited May 22, 2008 by ProgAndy *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...
Kip Posted May 27, 2008 Author Share Posted May 27, 2008 I added 21 new functions, multiple controls support, and autocomplete for variables (i'm sure you can add autocomplete for functions by yourself ) MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
Szhlopp Posted September 5, 2008 Share Posted September 5, 2008 Hey Kip! Nice UDF! I have a question for you. How do I go about adding an embedded SciTE into a Tab control? It all runs fine but nothing shows up. And after messing with it I realized I had to supply it the handle to the window. Is there anything I can do to make this work inside the tab not below the tab? Thanks RegEx/RegExRep Tester!Nerd Olympics - Community App!Login UDFMemory UDF - "Game.exe+753EC" - CE pointer to AU3Password Manager W/ SourceDataFiler - Include files in your au3!--- Was I helpful? Click the little green '+' Link to comment Share on other sites More sharing options...
Kip Posted September 5, 2008 Author Share Posted September 5, 2008 Create a small tab control above it. So you only see the tab buttons, not the tab pages. Then check if a tab is pressed, if so: show scilexer, else: hide it MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
Kip Posted September 9, 2008 Author Share Posted September 9, 2008 Added 9 new functions! they all are style functions. - Sci_StyleApply() - Sci_StyleSet() - Sci_StyleClearAll() - Sci_GetStyleAt() - Sci_SetLexer() - Sci_GetLexer() AutoIt isn't the default language anymore, so it's time to make something on your own. You can use Sci_SetLexer() to switch back to AutoIt though. MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
ProgAndy Posted September 10, 2008 Share Posted September 10, 2008 You should rename your functions to normal UDf Style.the public Functions _Sci_ or _GUICtrlSciLexer_and the internal funcs with like the standard funcs, but with double underscore at the beginning So there will be less problems if those functions are used in other UDFs *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...
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