Jump to content

Recommended Posts

Posted

@Jos

A few remarks.

  • "autocomplete.au3.disable" still doesn't works properly. I have made some changes in AutoItAutoComplete.lua, that fix the problem. In addition, I have added the "calltips.au3.disable" property. Now we can disable Autocomplete and Calltips separately leaving the possibility to call them manually.

    --------------------------------------------------------------------------------
    -- This library provides some convenience when working in AutoIt scripts.  It
    -- causes the AutoComplete and CallTips() to behave more intelligently.
    --------------------------------------------------------------------------------
    AutoItAutoComplete = EventClass:new(Common)
    
    --------------------------------------------------------------------------------
    -- OnStartup()
    --
    -- Initializes variables.
    --------------------------------------------------------------------------------
    function AutoItAutoComplete:OnStartup()
        -- Variable mappings for SciTE menu commands.
        self.IDM_SHOWCALLTIP = 232
        self.IDM_COMPLETE = 233
        self.IDM_COMPLETEWORD = 234
        self.Check_Calltip = false
    
        -- List of "valid" styles as used by IsValidStyle().
        self.style_table =
        {
            SCE_AU3_COMMENTBLOCK,
            SCE_AU3_COMMENT,
            SCE_AU3_STRING,
            SCE_AU3_SPECIAL,
            SCE_AU3_COMOBJ
        }
    end -- OnStartup()
    
    --------------------------------------------------------------------------------
    -- OnUpdateUI()
    --
    -- Controls showing CallTips.
    --
    -- Parameters:
    --
    --------------------------------------------------------------------------------
    function AutoItAutoComplete:OnUpdateUI()
        -- Check for showing Calltip. this is activate by the OnKey check of "," or "(" but moved here because at this time the StyleAt is know for the typed character
        if self:IsLexer(SCLEX_AU3) and self.Check_Calltip then
            self.Check_Calltip = false
            local style = editor.StyleAt[editor.CurrentPos-1]
            -- Only update calltip when an operator is typed
            if style ~= SCE_AU3_OPERATOR then return false end
            scite.MenuCommand(self.IDM_SHOWCALLTIP)
            return
        end
    end
    --------------------------------------------------------------------------------
    -- OnChar(c)
    --
    -- Controls showing and hiding of AutoComplete and CallTips.
    --
    -- Parameters:
    --  c - The character typed.
    --------------------------------------------------------------------------------
    function AutoItAutoComplete:OnChar(c)
        -- Make sure we only do this for the AutoIt lexer.
        if self:IsLexer(SCLEX_AU3) then
    
            -- Show CallTip when a comma is typed to delimit function parameters.
            if ((c == "," or c == "(" or c == ")")) then
                if (c == ",") or (c == ")") then
                    if editor:CallTipActive() then
                        return
                    end
                end
                if props["calltips.au3.disable"] == "1" then
                    return true
                end
    
                -- set variable to 1 and let AutoItAutoComplete:OnUpdateUI handle the rest as only then the StyleAt is proper set
                self.Check_Calltip = true
                return
            end
    
            if props['autocomplete.au3.disable'] == "1" then
    --          self:CancelAutoComplete()
                return true
            end
    
            if editor:CallTipActive() then
                return
            end
    
            -- Show variables in AutoComplete.
            if (c == "$" and self:IsValidStyle(style)) then
                scite.MenuCommand(self.IDM_COMPLETEWORD)
                return
            end
    
            -- Show macros in AutoComplete.
            if (c == "@" and self:IsValidStyle(style)) then
                scite.MenuCommand(self.IDM_COMPLETE)
                return
            end
    
            -- Skip showing AutoComplete on _ as the first character.
            if c == "_" and editor:WordStartPosition(editor.CurrentPos) + 1 == editor.CurrentPos then
                self:CancelAutoComplete()
                return true
            end
    
            -- Ensure the character is a valid function character.
            if not self:IsValidFuncChar(c) then
                return
            end
    
            -- Cancels AutoComplete if the previous character is a period.  It means
            -- we're typing a COM method but the style isn't set yet.
            if c2 == "." then
                return self:CancelAutoComplete()
            end
    
            -- Show AutoComplete if it isn't showing already.
            if not editor:AutoCActive() then
                scite.MenuCommand(self.IDM_COMPLETE)
                -- fall through
            end
    
            -- Last attempt to show AutoComplete.
            if not editor:AutoCActive() then
                scite.MenuCommand(self.IDM_COMPLETEWORD)
                return
            end
        end
    end -- OnChar()
    
    --------------------------------------------------------------------------------
    -- IsValidStyle(style)
    --
    -- Checks if the style is _not_ in the table.
    --
    -- Parameters:
    --  style - The style to check.
    --
    -- Returns:
    --  The value true is returned if the style is _not_ in the table.
    --  The value false is returned if the style is in the table.
    --------------------------------------------------------------------------------
    function AutoItAutoComplete:IsValidStyle(style)
        if self.style_table then
            for i, v in ipairs(self.style_table) do
                if style == v then
                    return false
                end
            end
        end
        return true
    end -- IsValidStyle()
    
    --------------------------------------------------------------------------------
    -- IsValidFuncChar(c)
    --
    -- Checks to to see if a character is a valid function name character.
    --
    -- Parameters:
    --  c - The character to check.
    --
    -- Returns:
    --  The value true is returned if the charcter is a valid function character.
    --  The value false is returned if the characer is not valid.
    --------------------------------------------------------------------------------
    function AutoItAutoComplete:IsValidFuncChar(c)
        return string.find(c, "[_%w]") ~= nil
    end -- IsValidFuncChar()
    
    --------------------------------------------------------------------------------
    -- IsQuoteChar(c)
    --
    -- Checks to see if a character is a single (') or double (") quote.
    --
    -- Parameters:
    --  c - The character to check.
    --
    -- Returns:
    --  The value true is returned if the character is a quote character.
    --  The value false is returned if the character is not a quote character.
    --------------------------------------------------------------------------------
    function AutoItAutoComplete:IsQuoteChar(c)
        return string.find(c, "[\"\']") ~= nil
    end -- IsQuoteChar()

  • A small bug with AutoItPixmap.lua. If we call Autocomplete manually for "$" or "_" symbols, the icons color will not change. This is assuming that characters were not typed before. To solve this problem we need to call AutoItPixmap:OnChar() before the Autocomplete appears.
  • I wrote a small utility that opens the selected file or folder in Windows Explorer. This utility can work with AutoIt expression and environment variables, e.g.

    @ScriptDir & "ResourcesApp.ico"

    @TempDir

    %USERPROFILE%SciTE.session

    Readme.txt

    etc.

    #pragma compile(Out, ExpOpen.exe)
    #pragma compile(Icon, ExpOpen.ico)
    #pragma compile(FileDescription, Opens Windows Explorer and selects the file or folder)
    #pragma compile(FileVersion, 1.0.0.0)
    #pragma compile(LegalCopyright, ©Yashied)
    #pragma compile(OriginalFilename, ExpOpen.exe)
    #pragma compile(ProductName, Explorer Opener)
    #pragma compile(ProductVersion, 1.0)
    
    #NoTrayIcon
    
    #Include <MsgBoxConstants.au3>
    #Include <WinAPI.au3>
    #Include <WinAPIShellEx.au3>
    #Include <WinAPIShPath.au3>
    
    Local $__Path, $__Text, $__Result, $__AutoIt = False
    
    If $CmdLine[0] = 0 Then
        MsgBox($MB_ICONINFORMATION, 'ExpOpen', 'Used only in SciTE.' & @CR & @CR & 'ExpOpen "$(FilePath)" "$(CurrentSelection)"')
        Exit
    EndIf
    If $CmdLine[0] < 2 Then
        Exit
    EndIf
    If (StringInStr($CmdLine[2], @CR)) Or (StringInStr($CmdLine[2], @LF)) Then
        ConsoleWrite('! Bad path.' & @CRLF)
        Exit
    EndIf
    If _WinAPI_PathFindExtension($CmdLine[1]) = '.au3' Then
        $__AutoIt = True
    EndIf
    $__Text = StringStripWS(StringReplace($CmdLine[2], @TAB, ' '), 7)
    If $__AutoIt Then
        $__Text = StringRegExpReplace($__Text, '^[;\h]+', '')
    EndIf
    If Not $__Text Then
        Exit
    EndIf
    $__Path = _WinAPI_PathRemoveFileSpec($CmdLine[1])
    If Not FileExists($__Path) Then
        Exit
    EndIf
    If $__AutoIt Then
        If StringInStr($__Text, @AutoItExe) Then
            ConsoleWrite('! Bad filename or expression.' & @CRLF)
            Exit
        EndIf
        $__Text = StringReplace($__Text, '@ScriptName', '"' & _WinAPI_PathStripPath($CmdLine[1]) & '"')
        $__Text = StringReplace($__Text, '@ScriptDir', '"' & $__Path & '"')
        $__Text = StringReplace($__Text, '@ScriptFullPath', '"' & $CmdLine[1] & '"')
        $__Text = StringReplace($__Text, '@WorkingDir', '"' & $__Path & '"')
        Switch StringLeft($__Text, 1)
            Case "'", '"'
    ;~          If True Then
                    $__Result = Execute($__Text)
    ;~          EndIf
            Case Else
                If __Search($__Text) = 1 Then
                    $__Result = Execute($__Text)
                Else
                    $__Result = Execute('"' & $__Text & '"')
                EndIf
        EndSwitch
        If (@Error) Or (Not $__Result) Then
            ConsoleWrite('! Bad filename or expression.' & @CRLF)
            Exit
        EndIf
    Else
        $__Result = $__Text
    EndIf
    $__Result = StringRegExpReplace($__Result, '^["''\\\h]+|["''\\\h]+$', '')
    $__Result = _WinAPI_ExpandEnvironmentStrings($__Result)
    If _WinAPI_PathIsRelative($__Result) Then
        $__Result = _WinAPI_PathAppend($__Path, $__Result)
    EndIf
    $__Result = _WinAPI_PathSearchAndQualify($__Result)
    If Not FileExists($__Result) Then
        ConsoleWrite('! Path not found.' & @CRLF)
        Exit
    EndIf
    If Not _WinAPI_ShellOpenFolderAndSelectItems($__Result) Then
        ConsoleWrite('! Unable to open folder.' & @CRLF)
    EndIf
    
    Func __Search($__Path)
        Local $__Index = 0
        Local $__Macro[23] = [ _
                '@AppDataCommonDir', _
                '@DesktopCommonDir', _
                '@DocumentsCommonDir', _
                '@FavoritesCommonDir', _
                '@ProgramsCommonDir', _
                '@StartMenuCommonDir', _
                '@StartupCommonDir', _
                '@AppDataDir', _
                '@LocalAppDataDir', _
                '@DesktopDir', _
                '@MyDocumentsDir', _
                '@FavoritesDir', _
                '@ProgramsDir', _
                '@StartMenuDir', _
                '@StartupDir', _
                '@UserProfileDir', _
                '@HomeDrive', _
                '@HomePath', _
                '@ProgramFilesDir', _
                '@CommonFilesDir', _
                '@WindowsDir', _
                '@SystemDir', _
                '@TempDir' _
                ]
    
        For $i = 0 To UBound($__Macro) - 1
            $__Index = StringInStr($__Path, $__Macro[$i])
            If $__Index Then
                ExitLoop
            EndIf
        Next
        Return $__Index
    EndFunc   ;==>__Search
Posted

Is there maybe some newer version of lua script that creates a Function Header, which would be compatible with:

https://www.autoitscript.com/wiki/Best_coding_practices

mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

  • Developers
Posted

  On 2/16/2015 at 10:30 AM, Yashied said:

@Jos

A few remarks.

  • "autocomplete.au3.disable" still doesn't works properly. I have made some changes in AutoItAutoComplete.lua, that fix the problem. In addition, I have added the "calltips.au3.disable" property. Now we can disable Autocomplete and Calltips separately leaving the possibility to call them manually.

Merged your update with my version ... Thanks

  On 2/16/2015 at 10:30 AM, Yashied said:
  • A small bug with AutoItPixmap.lua. If we call Autocomplete manually for "$" or "_" symbols, the icons color will not change. This is assuming that characters were not typed before. To solve this problem we need to call AutoItPixmap:OnChar() before the Autocomplete appears.

Not sure what needs changing here.

  On 2/16/2015 at 10:30 AM, Yashied said:
  • I wrote a small utility that opens the selected file or folder in Windows Explorer. This utility can work with AutoIt expression and environment variables, e.g.

Not sure this is something people will use a lot. I mostly use Ctrl+e to open the Explorer in the Script directory.

Thanks again for your input

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

  • Developers
Posted
  On 2/16/2015 at 5:40 PM, mLipok said:

Is there maybe some newer version of lua script that creates a Function Header, which would be compatible with:

https://www.autoitscript.com/wiki/Best_coding_practices

mLipok

I haven't.

Send me an updated LUA file and I can merge it into the production version.

Cheers

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted

Can team intergrated folder and file explorer in SciTE? It's help us control our example better. And if you can, please improve Scite Editor GUI, it's seem very simple. Thank you! :sweating:

Posted
Minimalism is an advantage.
If you want fireworks, a search for them here.

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

  • Developers
Posted
  On 2/17/2015 at 4:58 AM, Kudo said:

Can team intergrated folder and file explorer in SciTE? It's help us control our example better.

No clue what you are suggesting.

 

  On 2/17/2015 at 4:58 AM, Kudo said:

 And if you can, please improve Scite Editor GUI, it's seem very simple. Thank you! :sweating:

I am using the standard SciTE published by Neil Hodgson so any design request/suggestion should be posted there.

Having said that I completely disagree and like it simple and sweet but could be biased. ;)

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted
  On 2/17/2015 at 6:53 PM, Jos said:

No clue what you are suggesting.

 

I am using the standard SciTE published by Neil Hodgson so any design request/suggestion should be posted there.

Having said that I completely disagree and like it simple and sweet but could be biased. ;)

Jos

 

It is my suggest: sidebar folder and file explorer

e79e37b6750b0b93b68f8a4fc9faff5e.png

About SciTE GUI, it just my opinion  :sweating: . I think should be change icon or style or upgrade with style importing (example) because i like dark style very much  :zorro:

  • Developers
Posted
  On 2/18/2015 at 9:14 AM, Kudo said:

About SciTE GUI, it just my opinion  :sweating: . I think should be change icon or style or upgrade with style importing (example) because i like dark style very much  :zorro:

Nice but again: I am not going to even look at this as I am using the standard SciTE distribution. ;)

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

  • Developers
Posted
  On 2/18/2015 at 7:33 PM, Chimaera said:

geez that is nasty why would anyone want that colour

Lets not go there and share thought on the request in this thread. It ain't happening so end-of-discussion ;)

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted

Bug found in Au3Stripper.

Relative includes are ignored if Au3Stripper executed not from script's dir:

#include "../MyInclude.au3"

It should take the script's path and able to find relative includes from that directory as well.

 

  Reveal hidden contents

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

  • 2 weeks later...
Posted

Or on pure / old LCD Display panel.

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

  • Developers
Posted (edited)
  On 2/27/2015 at 8:22 PM, jaberwacky said:

I would like to make a feature request for SciTEConfig please.  Add the option to change the caret line color alpha.  It makes caret line back look better for dark themes.

Are you referring to this parameter?: caret.line.back.alpha

Looking into this... more to follow.

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted (edited)

If I may be so bold, I went ahead and took the liberty of implementing this to be best of my ability.

Edit -- Scractch that: I missed something.  Will return shortly.

Edit2: Ok, seems like I might still be missing something.  But if you're interested, I'll leave that up to you.

Edit3: Nailed it.

Well, this is close but there might still be an issue.  As far as I can tell I mimicked selection_bkcolor and selection_alpha, but not selection_color because caret line doesn't have a fore setting.  No, turns out I was probably just not doing it right.  I think it does work!

Edited by jaberwacky
  • Developers
Posted

Thanks for your input. I actually did already code it yesterday and made also changes to the setting for the Selected line Alpha.

It should be between 0-256 where 256 is disabled.

There was also the issue that when the value is 255, it really should only show the background colour without any character to exactly simulate the behaviour in SciTE.

I will see what you have done, but think  I am close to the real SciTE behaviour, except taking into account that the Selected and the current caret line both apply at the same time, which isn't reflected in the displayed labels.

Jos 

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

  • Developers
Posted

Uploaded a new Beta for SciTEConfig with the added  caret line background color alpha and changed logic to better replicate the result in the shown labels.

Let me know if that works.

By the way: I figured I like the 256 setting for both the most. :)

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted (edited)

Awesome!  Thanks once again Jos.

Here are those themes.

SciTEConfigThemes.zip

  On 3/3/2015 at 5:58 PM, Jos said:

By the way: I figured I like the 256 setting for both the most. :)

Whatever floats your boat.  I aint one to judge.  ;)

Edited by jaberwacky
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...