Jump to content

SciTE Clone - AutoIt SciTE impostor


Skitty
 Share

Recommended Posts

AutoIt and Scintilla based Text Editor a.k.a ASciTE

Based off of and ' frameborder='0' data-embedContent>text editors! Click their names to see their projects!

Posted Image Posted Image

Posted Image Posted Image

Tested only on Win XP 32bit.

This will not work on 64bit systems!

ASciTE script source => ASciTE.rar

Previous Downloads: 44

ASciTE Script Source => ASciTE.rar

Previous Downloads: 10

ChangeLog

7/1/12 - Added new version, previous one had a syntax error I forgot to remove for use in the images above, I also noticed that the file cannot be processed by the obfuscator, using the obfuscator, the script will loose some features like the inter process communication.

7/1/12 - Fixed error as pointed out by ldub, also fixed several spelling errors, fixed some comments.

7/2/12 - Added text and AutoIt language options and added error highlighting for the scintilla debug console.

7/2/12 - Added change pointed out by also added support for highlighting HTML, conf, properties and ini files.

7/2/12 - Added modified function by AZJIO to retrieve SciTE properties, also added more code that retrieves color settings from properties, margin areas now also use the same color as SciTE.

7/2/12 - Added bug fix as pointed out by

7/3/12 - Modified status bar to use 3 stage display info, click on it to cycle through information like in SciTE.

7/6/12 - Implemented mouse hook for re-sizing console window thanks to MrCreatoR; Implemented windows hook for unhooking mouse hook when not needed, thanks to rasim; Minor changes to resizing scheme to fix painting bugs and sizing issues; Better handling of painting some controls; Tabs and console window now do not freeze up when running scripts; Double clicking the Scintilla control no longer freezes ASciTE temporarily; Debug window now scrolls with new appended data; Minor modifications to the resizing bar; Modification to search feature; The entire script no longer uses on event mode due to conflicts with the mouse hook, the script is entirely reliant on interpreting windows messages, which should make the UI very responsive

7/9/12 - Fixed error with accelerator keys not working due to me forgetting to add the controls to the windows message functions. Some other minor modifications to the

​mouse hook functionality.

7/11/12 - Fixed small error in code I made where messages from the search box were not being processed due to window focus.

7/14/12 - Fixed small error with undeclared variable...

Details

Problems that I am trying to solve include the GDI tab drag marker, it only appears randomly now.

I've attempted to keep the code as tidy as I could and easy to navigate by enclosing similar functionality in region tags in hopes that it will be easier for anyone to improve on this or extract things from it.

Other Files

Here are some extractions from the script of thing that took conciderable time, I've taken out what I would assume some people would probably want, such as the arrow for the tab switching (Which stopped working in the latest version) and the IPC (inter process communication) through windows messages that was created for this script from code by wolf9228 in this

Tab re-ordering indicator (little red arrow) => Tab Reposition.au3

IPC Script Communication => Simple IPC.au3

Feature details

features
  • Tab reordering
  • Text Search
  • AutoComplete
  • Calltips
  • Portable or installed mode*
  • Error Annotations
  • Uses Scites properties
  • Top/Bottom debug snap
  • Debug console errors are clickable
  • Error markers
  • Debug Console error highlighting
  • Fully resizable**
Syntaxes Supported
  • Text (Default)
  • AutoIt
  • HTML
  • Properties (conf, properties)
The script is a little buggy, I've attempted to use a form of IPC (interprocess communication) to handle several instances, only one instance will ever be active using a modified _singlton() variation, upon launching a second time, the secondary instance will dispatch a windows message that was created for the session and instance of ASciTE, the window message will prompt the script to do either of two things~

1) Activate the initial ASciTE instance;

2) If files were dropped on the EXE, the secondary instance passes a string containing the paths of the dropped files to the initial instance prompting ASciTE to open those dropped files.

Take note that the above behavior only works when compiled.

*Portable mode is activated when the "AutoIt3" directory is found in the same directory as the script, but if an installed version is detected, it will default to using that one.

** There is a bug present that I could not figure out where double clicking on the title bar to maximize the window will cause the script to forget its initial size causing the script to stay full screen when re-sized in this manner :(

Other information

Known issues / Script bugs

1) Dropping files on the GUI will cause a beep/ping sound to play (invalid action notification or something) which seems to be due to the multiple windows that are used in the project.

2) The calltips are a little buggy at times, I am not responsible for the code concerning call tips and didn't look into it much.

3) Abbreviations are a little buggy, some work, some don't. Again, I am not responsible for that code.

4) Sometimes, using the search feature will cause the script to go haywire, this is a problem with the code I took from example and again, I am not responsible for most of that code, but I'm not sure if the bug was something that I caused.

5) As mentioned before, the tab drag marker is buggy

6) Due to the mouse hook, clicking the title bar icons such as the close button or maximize button etc will cause a short delay.

Credits

- for code I use in the toolbar image for the Close icon, Progandy is also responsible for some of the Scintilla UDF functions.

- for his modifications to some of the Scintilla UDF functions and various other Scintilla related code in the WM_NOTIFY function that interacts with the scintilla control

?do=embed' frameborder='0' data-embedContent> - wrote an example that helped me understand how to create the dragable editor and debug seperator, I also use his examples resizing scheme for the resizing position of the drag-bar which works flawlessly (Re-sizing).

- for the searchbox I use

wolf9228 - for an example that helped me complete the functionality I was looking for with the script communication

UEZ - for helpng me with the Close BMP icon transparancy in the toolbar that is custom with SciTE

Yashied - because much things have been learned

Trancexx - for knowledge in the color conversion bit in the configs

Jos - for SciTe4AutoIt

BrewManNH - for giving me an idea as to how to better parse the SciTE configuration files

- For an improved regular expression method to retrieve properties from SciTE configuration files

- Fixed 2 bugs with ASciTE, also made the mouse hooking code I use

rasim - For the windows hooking functionality

Background

6/7/12 - I saw a thread where posted a text editor he made, it intrigued me and I wanted to know if syntax highlighting could be used in it, I got curious and remembered that has a huge text editor project written in AutoIt that supported syntax highlighting, I noticed he was using a Scintilla UDF created by and I grabbed the version that was posted by and started writing a script that would use it and posted it .

On my free time I felt compelled to keep adding things, test my ability to replicate, look and act like SciTE (I mean the script, not me). I looked into ISI360s project and took some of the additions he made to the scintilla UDF and built a little on it. I then furiously Googled away and encountered many things that helped me create this, like "GUIDragTab" example, ?do=embed' frameborder='0' data-embedContent> "split your GUI" example.

I also ended up using searchbox from a project they have that supports multiple syntax highlighting.

So with that, you should now have the impression that this is not some kind of SciTE replacement or intends to be. Which would be correct. This is merely the result of taking interest into ReaperXs text editor, building on it, adding functionality from other scripts with similar operation and attempting to create a UI that would display the capabilities of AutoIt.

The more you know...

1) When typing in the "$" dollar sign for variables, it seems there is a function someone made that will process the heck out of it by going through a large array of existing words, this will cause a 1-3 second freeze while the operation is processed.

Both this and the above happen in the WM_NOTIFY function.

2) relaunching the script when compiled will only activate the existing instance of ASciTE.

3) Dropping files on the script executable will trigger the existing instance of ASciTE to open those files.

4) opening a very large binary file will crash ASciTE

More to come as I remember them..

Edited by ApudAngelorum
Link to comment
Share on other sites

I am amazed ! It is so fast.

Sometimes, I confuse the clone from the original.

Some details : I have not been able to launch Tidy (error arguments) and I have been obliged to change the color of the backgoung (to white).

Thanks for sharing.

Link to comment
Share on other sites

I am amazed ! It is so fast.

Sometimes, I confuse the clone from the original.

Some details : I have not been able to launch Tidy (error arguments) and I have been obliged to change the color of the backgoung (to white).

Thanks for sharing.

Thnaks for the tip, I remember reading through the autoit3wrapper and noticing it had options to run tidy, I changed the way it is run now and it should work :)

Link to comment
Share on other sites

The problem with reading

Thanks, I was looking for something like that earlier, it looks better than what I am currently doing for retrieving the color properties.

I will attempt to implement it in the project soon.

I've also uploaded an updated version which supports errlist error highlighting, the debug scintilla console now looks and acts more like SciTEs scintilla debug console, aside from the fact that you cannot run dos commands from it.

I've also added language options for AutoIt and text atm, I am planing on adding html next. HTML added.

Edited by ApudAngelorum
Link to comment
Share on other sites

Very good project.

There is bug with search feature.

When searching up, the search begins from the last found string, not from the current position.

Can be fixed by replacing:

$startPosition = SendMessage($Tabs[$ActiveTab][1], $SCI_GETTARGETSTART, 0, 0)

with:

$startPosition -= $lenFind

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

Very good project.

There is bug with search feature.

When searching up, the search begins from the last found string, not from the current position.

Can be fixed by replacing:

$startPosition = SendMessage($Tabs[$ActiveTab][1], $SCI_GETTARGETSTART, 0, 0)

with:

$startPosition -= $lenFind

Appreciate it, added the change you specified and also added support for highlighting HTML and typical properties files suchs as those used by SciTE and conf or ini files.
Link to comment
Share on other sites

work is partially

$Var = ''
$Config = FileRead(@UserProfileDir & "SciTEUser.properties")
_GetProperty($Var, $Config, "style.au3.0", "fore")
MsgBox(0, 'Сообщение', $Var)

Func _GetProperty(ByRef $Var, $Config, $Property, $Which = 0, $Rev = 0)
    Local $Test = StringRegExp($Config, 'Q' & $Property & 'E=([^v]+)', 1)
    If @error Then Return
    Switch StringLower($Which)
        Case "fore", "back" ; Foreground, Background color
            $Test = StringRegExp($Test[0], '(?i)'&$Which&':#([[:xdigit:]]+)', 1)
        Case "#" ; just the color
            $Test = StringRegExp($Test[0], '#([[:xdigit:]]+)', 1)
    EndSwitch
    If @error Then Return
    If $Rev Then $Test[0] = _Rev($Test[0])
    $Var = $Test[0]
    Return
EndFunc   ;==>_GetProperty
Global settings are not perceived

# All files
style.*.32=fore:#999999,back:#3F3F3F,$(font.base)
style.*.33=fore:#8A8A8A,back:#0C0C0C,$(font.base)
style.*.34=fore:#0080FF,back:#000000
style.*.35=fore:#71AE71,italics,back:#3F3F3F
#style.*.36=fore:#ff0000,back:#0000ff - ???
style.*.37=fore:#8A8A8A,back:#0C0C0C
Edited by AZJIO
Link to comment
Share on other sites

Awesome, I just replaced the function entirely with yours and it apparently worked flawlessly, my regexp experience is limited.

I also made a few changes to the script in order to make it look a little more like scite, for instance, the script margin colors (where the line numbers are at) now use the color scheme from the SciTE config.

Now what's left to do it make the script also fetch the bold and italics style that belong to the specific styles.

Link to comment
Share on other sites

There is one more small bug.

I have not position properties in my scite session file, so the gui shown only with the title visible :).

You should add “default” for GetProperty function:

Func _GetProperty(ByRef $Var, $Config, $Property, $Which = 0, $Rev = 0, $Default = '')
    If $Default = '' Then $Default = $Var
    Local $Test = StringRegExp($Config, 'Q' & $Property & 'E=([^v]+)', 1)

    If @error Then
        $Var = $Default
        Return SetError(1)
    EndIf
    
    Switch StringLower($Which)
        Case "fore", "back" ; Foreground, Background color
            $Test = StringRegExp($Test[0], '(?i)'&$Which&':#([[:xdigit:]]+)', 1)
        Case "#" ; just the color
            $Test = StringRegExp($Test[0], '#([[:xdigit:]]+)', 1)
    EndSwitch

    If @error Then
        $Var = $Default
        Return SetError(2)
    EndIf
    
    If $Rev Then $Test[0] = _Rev($Test[0])
    $Var = $Test[0]
    Return
EndFunc

and then get the position vars like this:

If FileExists($SciTE_Session) Then
        $Properties = FileRead($SciTE_Session)
        $SciteConfig = $Properties & @CRLF
        _GetProperty($UI_LEFT, $SciteConfig, "position.left", 0, 0, -1)
        _GetProperty($UI_RIGHT, $SciteConfig, "position.top", 0, 0, -1)
        _GetProperty($UI_WIDTH, $SciteConfig, "position.width", 0, 0, 700)
        _GetProperty($UI_HEIGHT, $SciteConfig, "position.height", 0, 0, 350)
        _GetProperty($Maximize, $SciteConfig, "position.maximize", 0, 0, 0)
    Else
        $UI_LEFT = -1
        $UI_RIGHT = -1
        $UI_WIDTH = 700
        $UI_HEIGHT = 350
        $Maximize = 0
    EndIf

BTW, as you can see, i changed a little bit the hight to height, it's just spelling mistake :whistle:.

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

Thanks again, I wasn't expecting some peoples session files to be void of those properties, leads me to believe there may be more things that have been over looked now.

Upload now has latest changes as provided by you.

Lately I've had too much spare time on my hands, and this script is a byproduct of that :P

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...