Jump to content
Advert

Recommended Posts

Posted

if it doesn't mark the $g_hUnSavedColor = 0xFF6A00 ; Orange for not stored
then it can't read the text from the tabs and that's why it marks them all because they have the same name

I know that I know nothing

Advert
Posted (edited)
...
Global $g_iTopBarHeightBase = 3, $g_iTopBarHeight = $g_iTopBarHeightBase  ; Significant line thickness
...
Local $iTempH = 0, $aPos = WinGetPos($g_SciTE_Handle)
...
        $g_aOverlayHwnd[$i] = _ManageOverlay($hTab, $tRect, $iBgColor, $g_aOverlayHwnd[$i], False)
        If $iTempH = 0 And @extended Then
            $iTempH = @extended
            $g_iTopBarHeight = $iTempH / 20 * $g_iTopBarHeightBase
        EndIf
...
    Return SetError(0, $iH, $hOverlay)
EndFunc   ;==>_ManageOverlay
...

..that way the purple bar's size is dynamic and looks about the same ( give or take a pixel ) when I move the editor from one monitor to the other :)

Since the above + prior edits may make no sense, here is the full edit:

Spoiler
; https://www.autoitscript.com/forum/topic/213330-scite_overlaytab/
;--------------------------------------------------------------------------------------------------------------------------------
; Title...........: SciTE_OverlayTab.au3
; Description.....: Highlighting the active & unsaved tab item in SciTE
; AutoIt Version..: 3.3.18.0   Author: ioa747           Script Version: 0.11
; Note............: Testet in Windows 11 Pro 24H2       Date:25/03/2026
;                   New Layer added (Significant)  toggled with Ctrl+Shift+6
; ..argumentum messing with it 😁
;--------------------------------------------------------------------------------------------------------------------------------
#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7
;~ #AutoIt3Wrapper_UseX64=y

#include <GuiTab.au3>
#include <Misc.au3>
#include <WinAPISysWin.au3>
#include <WindowsStylesConstants.au3>
#include <WinAPIProc.au3>
#include <WinAPIMem.au3>
#include <WinAPIGdiDC.au3>

;~ Opt('TrayIconHide', 1) ; argumentum ; to see it in the Tray now that it's reentrant ; debug
TraySetIcon(StringLeft(@AutoItExe, StringInStr(@AutoItExe, "\", 0, -1) - 1) & "\SciTE\SciTE.exe", 0) ; argumentum ; debug
TraySetToolTip(@ScriptName & '  -  ' & (@AutoItX64 ? "x64" : "x86") & @LF & "SciTE not loaded" & @LF & " ") ; argumentum ; debug
_Singleton(@ScriptName)

While Not WinExists(WinGetHandle('[CLASS:SciTEWindow]')) ; argumentum
    Sleep(2000)
WEnd

Global Const $g_hActiveColor = 0x0026FF      ; Blue for active
Global Const $g_hUnSavedColor = 0xFF6A00     ; Orange for not stored
Global Const $g_hSignificantColor = 0x800080 ; Purple for Significant
Global Const $g_iOpacity = 50                ; Background transparency
Global $g_iTopBarHeightBase = 3, $g_iTopBarHeight = $g_iTopBarHeightBase  ; Significant line thickness ; argumentum

Global $g_aOverlayHwnd[0]
Global $g_aItemsText[0]
Global $g_aSigOverlayHwnd[0]
Global $g_mSignificant[]
Global $g_SciTE_Handle = WinGetHandle('[CLASS:SciTEWindow]')
Global $g_sLastState = ""

If Not $g_SciTE_Handle Then Exit

HotKeySet("^+6", "_ToggleSignificant") ; <<--( toggled Significant with Ctrl+Shift+6 )--<<
OnAutoItExitRegister(_Exit)

_EnableHighDPI(_GetProcessDPIAwarenessLevel($g_SciTE_Handle))

TraySetToolTip(@ScriptName & '  -  ' & (@AutoItX64 ? "x64" : "x86") & @LF & "DPI_AWARE: " & _GetProcessDPIAwarenessLevel($g_SciTE_Handle) & @LF & " ")


While WinExists($g_SciTE_Handle)
    ; Update only if SciTE is visible/active
    _SciTEState()
    Sleep(100)
WEnd
_Singleton("bye-" & @ScriptName)
ShellExecute(@AutoItExe, '"' & @ScriptFullPath & '"') ; argumentum ; lazy re-run

;---------------------------------------------------------------------------------------
Func _SciTEState()
    ; Retrieve the state of the SciTEWindow.
    Local $iState = WinGetState($g_SciTE_Handle)
    Switch $iState
        Case 15, 47 ; exists+visible+enabled+active +maximized
            _UpdateTabOverlays()
        Case Else
            Sleep(1000)
    EndSwitch
EndFunc   ;==>_SciTEState
;---------------------------------------------------------------------------------------
Func _UpdateTabOverlays()
    Local $hTab = ControlGetHandle($g_SciTE_Handle, "", "SciTeTabCtrl1")
    If @error Then Return

    Local $iCount = _GUICtrlTab_GetItemCount($hTab)
    Local $iActive = _GUICtrlTab_GetCurFocus($hTab)
    Local $iTempH = 0, $aPos = WinGetPos($g_SciTE_Handle)

    ; State Signature: '&6 SciTE_OverlayTab.au3|6|5|280|0|1647|1039'
    Local $sCurrentState = _SciTE_GetTabText($hTab, $iActive)
    $sCurrentState &= "|" & $iCount & "|" & $iActive
    $sCurrentState &= "|" & $aPos[0] & "|" & $aPos[1] & "|" & $aPos[2] & "|" & $aPos[3]

    If $sCurrentState = $g_sLastState Then Return

    $g_sLastState = $sCurrentState

    ; Synchronize tables if the number of Tabs changes
    If $iCount <> UBound($g_aOverlayHwnd) Then
        _CleanupOverlays()
        ReDim $g_aOverlayHwnd[$iCount]
        ReDim $g_aSigOverlayHwnd[$iCount]
        ReDim $g_aItemsText[$iCount]
    EndIf

    For $i = 0 To $iCount - 1
        Local $sRawText = _SciTE_GetTabText($hTab, $i)
        Local $sCleanID = _GetCleanTabID($sRawText)
        Local $tRect = _GUICtrlTab_GetItemRectEx($hTab, $i)
        $g_aItemsText[$i] = $sCleanID

        ; Active/Unsaved Overlay
        Local $iBgColor = 0
        If $i = $iActive Then
            $iBgColor = $g_hActiveColor
        ElseIf StringRight($sRawText, 1) = '*' Then
            $iBgColor = $g_hUnSavedColor
        EndIf

        $g_aOverlayHwnd[$i] = _ManageOverlay($hTab, $tRect, $iBgColor, $g_aOverlayHwnd[$i], False)
        If $iTempH = 0 And @extended Then ; argumentum
            $iTempH = @extended
            $g_iTopBarHeight = $iTempH / 20 * $g_iTopBarHeightBase
        EndIf

        ; Significant Overlay
        If MapExists($g_mSignificant, $sCleanID) Then
            $g_aSigOverlayHwnd[$i] = _ManageOverlay($hTab, $tRect, $g_hSignificantColor, $g_aSigOverlayHwnd[$i], True)
        Else
            If IsHWnd($g_aSigOverlayHwnd[$i]) Then GUIDelete($g_aSigOverlayHwnd[$i])
        EndIf
    Next
    _CleanSignificantMap()
EndFunc   ;==>_UpdateTabOverlays
;---------------------------------------------------------------------------------------
Func _GetCleanTabID($sText)
    If StringLeft($sText, 1) = "&" Then $sText = StringTrimLeft($sText, 3)
    If StringRight($sText, 1) = "*" Then $sText = StringTrimRight($sText, 2)
    Return $sText
EndFunc   ;==>_GetCleanTabID
;---------------------------------------------------------------------------------------
Func _CleanSignificantMap()
    If UBound($g_mSignificant) = 0 Then Return
    Local $aKeys = MapKeys($g_mSignificant)
    For $sKey In $aKeys
        Local $bFound = False
        For $i = 0 To UBound($g_aItemsText) - 1
            If $g_aItemsText[$i] == $sKey Then
                $bFound = True
                ExitLoop
            EndIf
        Next
        If Not $bFound Then MapRemove($g_mSignificant, $sKey)
    Next
EndFunc   ;==>_CleanSignificantMap
;---------------------------------------------------------------------------------------
Func _ToggleSignificant()
    Local $hTab = ControlGetHandle($g_SciTE_Handle, "", "SciTeTabCtrl1")
    If @error Then Return

    Local $sID = _GetCleanTabID(_SciTE_GetTabText($hTab, _GUICtrlTab_GetCurFocus($hTab)))

    If MapExists($g_mSignificant, $sID) Then
        MapRemove($g_mSignificant, $sID)
    Else
        $g_mSignificant[$sID] = True
    EndIf
    $g_sLastState = "?"
EndFunc   ;==>_ToggleSignificant
;---------------------------------------------------------------------------------------
Func _ManageOverlay($hTab, $tRect, $iColor, $hExisting, $bIsTopBar)
    If $iColor = 0 Then
        If IsHWnd($hExisting) Then GUIDelete($hExisting)
        Return 0
    EndIf

    ; Prepare point structure for coordinate conversion
    Local $tPoint = DllStructCreate("int X;int Y")
    DllStructSetData($tPoint, "X", $tRect.Left)
    DllStructSetData($tPoint, "Y", $tRect.Top)

    ; Convert Tab's client coordinates to absolute screen coordinates
    ; Since we are DPI Aware, this returns physical pixels
    _WinAPI_ClientToScreen($hTab, $tPoint)

    Local $iX = DllStructGetData($tPoint, "X")
    Local $iY = DllStructGetData($tPoint, "Y")

    ; Calculate width and height directly from the Rect structure
    Local $iW = $tRect.Right - $tRect.Left
    Local $iH = ($bIsTopBar ? $g_iTopBarHeight : ($tRect.Bottom - $tRect.Top))

    Local $hOverlay = $hExisting
    If Not IsHWnd($hOverlay) Then
        ; Create the overlay window
        $hOverlay = GUICreate("", $iW, $iH, $iX, $iY, $WS_POPUP, BitOR($WS_EX_TOOLWINDOW, $WS_EX_NOACTIVATE, $WS_EX_TRANSPARENT), $hTab)
        GUISetBkColor($iColor)
        WinSetTrans($hOverlay, "", ($bIsTopBar ? 150 : $g_iOpacity))
        GUISetState(@SW_SHOWNOACTIVATE, $hOverlay)
    Else
        ; If it already exists, just move and resize
        WinMove($hOverlay, "", $iX, $iY, $iW, $iH)
        GUISetBkColor($iColor, $hOverlay)
    EndIf

    Return SetError(0, $iH, $hOverlay) ; argumentum ; to return the current height
EndFunc   ;==>_ManageOverlay
;---------------------------------------------------------------------------------------
Func _CleanupOverlays()
    For $i = 0 To UBound($g_aOverlayHwnd) - 1
        GUIDelete($g_aOverlayHwnd[$i])
        GUIDelete($g_aSigOverlayHwnd[$i])
    Next
EndFunc   ;==>_CleanupOverlays
;---------------------------------------------------------------------------------------
Func _Exit()
    _CleanupOverlays()
    Exit
EndFunc   ;==>_Exit
;---------------------------------------------------------------------------------------
Func _SciTE_GetTabText($hTab, $iIndex)
    ; Static variables - Allocated ONLY ONCE
    Local Static $hProcess = 0
    Local Static $bIsTarget64 = False
    Local Static $pRemoteText = 0
    Local Static $pRemoteItem = 0
    Local Static $sTag = ""
    Local Static $bInitialized = False
    Local Static $tLocalItem = 0
    Local Static $iMaxLen = 512

    ; === Initialization Block: Runs ONLY ONCE ===
    If Not $bInitialized Then
        Local $iPID
        _WinAPI_GetWindowThreadProcessId($hTab, $iPID)

        $hProcess = _WinAPI_OpenProcess(BitOR($PROCESS_VM_OPERATION, $PROCESS_VM_READ, $PROCESS_VM_WRITE, $PROCESS_QUERY_INFORMATION), False, $iPID)
        If Not $hProcess Then Return ""

        If @OSArch = "X64" Then
            If Not _WinAPI_IsWow64Process($iPID) Then $bIsTarget64 = True
        EndIf

        $pRemoteText = _MemVirtualAllocEx($hProcess, 0, $iMaxLen * 2, $MEM_COMMIT, $PAGE_READWRITE)

        ; Define proper struct with padding for x64 alignment
        $sTag = $bIsTarget64 ? _
                "struct;uint Mask;uint State;uint StateMask;uint Padding;ptr Text;int TextMax;int Image;int Padding2;int64 Param;endstruct" : _
                "struct;uint Mask;uint State;uint StateMask;uint TextPtr;int TextMax;int Image;uint Param;endstruct"

        $tLocalItem = DllStructCreate($sTag)
        $pRemoteItem = _MemVirtualAllocEx($hProcess, 0, DllStructGetSize($tLocalItem), $MEM_COMMIT, $PAGE_READWRITE)

        $bInitialized = True
    EndIf

    ; === Fast Execution Block: Minimal CPU cycles ===
    DllStructSetData($tLocalItem, "Mask", 1) ; $TCIF_TEXT
    If $bIsTarget64 Then
        DllStructSetData($tLocalItem, "Text", $pRemoteText)
    Else
        DllStructSetData($tLocalItem, "TextPtr", $pRemoteText)
    EndIf
    DllStructSetData($tLocalItem, "TextMax", $iMaxLen)

    ; Write the local struct to the pre-allocated remote memory
    _WinAPI_WriteProcessMemory($hProcess, $pRemoteItem, DllStructGetPtr($tLocalItem), DllStructGetSize($tLocalItem), 0)

    ; Request data from SciTE (0x133C = TCM_GETITEMW)
    Local $iRet = _SendMessage($hTab, 0x133C, $iIndex, $pRemoteItem)

    Local $sText = ""
    If $iRet Then
        Local $tResult = DllStructCreate("wchar[" & $iMaxLen & "]")
        _WinAPI_ReadProcessMemory($hProcess, $pRemoteText, DllStructGetPtr($tResult), $iMaxLen * 2, 0)
        $sText = DllStructGetData($tResult, 1)
    EndIf

    Return $sText
EndFunc   ;==>_SciTE_GetTabText
;---------------------------------------------------------------------------------------
Func _GetProcessDPIAwarenessLevel($hWnd)
    Local $iPID
    _WinAPI_GetWindowThreadProcessId($hWnd, $iPID)

    Local $hProcess = DllCall("kernel32.dll", "ptr", "OpenProcess", "dword", 0x0400, "bool", False, "dword", $iPID) ; PROCESS_QUERY_INFORMATION
    If @error Or Not $hProcess[0] Then Return SetError(@error, 1, -2)

    ; 0 = Unaware, 1 = System Aware, 2 = Per Monitor Aware
    Local $aRet = DllCall("Shcore.dll", "long", "GetProcessDpiAwareness", "ptr", $hProcess[0], "int*", 0)

    _WinAPI_CloseHandle($hProcess[0])

    If @error Then Return SetError(@error, 2, -2)

    Switch $aRet[2]
        Case 0 ; PROCESS_DPI_UNAWARE
            ConsoleWrite("PROCESS_DPI_UNAWARE -1" & @CRLF)
            Return -1
        Case 1 ; PROCESS_SYSTEM_DPI_AWARE
            ConsoleWrite("PROCESS_SYSTEM_DPI_AWARE -2" & @CRLF)
            Return -2
        Case 2 ; PROCESS_PER_MONITOR_DPI_AWARE
            ConsoleWrite("PROCESS_PER_MONITOR_DPI_AWARE -4" & @CRLF)
            Return -4
        Case Else
            ConsoleWrite("Else -> PROCESS_SYSTEM_DPI_AWARE -2" & @CRLF)
            Return -2
    EndSwitch
EndFunc   ;==>_GetProcessDPIAwarenessLevel
;---------------------------------------------------------------------------------------
Func _EnableHighDPI($Awareness = -2)
    Local $hUser32 = DllOpen("user32.dll")
    Local $aRet = DllCall($hUser32, "bool", "SetProcessDpiAwarenessContext", "int_ptr", $Awareness)

    ; Fallback to basic DPI Awareness
    If @error Or Not $aRet[0] Then
        DllCall($hUser32, "bool", "SetProcessDPIAware")
    EndIf

    DllClose($hUser32)
EndFunc   ;==>_EnableHighDPI
;---------------------------------------------------------------------------------------

@ioa747 If you like an idea from this, add it to a next version :) 

..that thinking about it, I should look at SciTE's LUAs and make it run this on load instead of the "stay in the tray" I did 🤔

Edited by argumentum
..this works

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting  image.gif.922e3a93535f431de08b31ee669cc446.gif
autoit_scripter_blue_userbar.png

Posted (edited)

ok, the LUA way:
In SciTEUser.properties we add: 

# scite_overlaytab - Initialize a startup flag to use in "PersonalTools.lua"
sciteOverlaytab.startup.ran=0

then in PersonalTools.lua we add:

function PersonalTools:OnStartup()

    -- Run once per session "flag" from the "SciTEUser.properties" entry
    if props['sciteOverlaytab.startup.ran'] == '1' then return end
    props['sciteOverlaytab.startup.ran'] = '1'


    -- Paths go here
    local sciteDir = props['SciteDefaultHome']
    local interpreter = sciteDir .. "\\..\\AutoIt3_x64.exe"
    local scriptFile = sciteDir .. "\\..\\Extras\\scite_overlaytab\\scite_overlaytab_v11.au3"
    
    -- FileExists() check
    local f1 = io.open(interpreter, "r")
    local f2 = io.open(scriptFile, "r")
    
    if f1 and f2 then
        f1:close()
        f2:close()
        
        -- Build the command to run:
        -- local cmd = [[start /b "" "]] .. interpreter .. [[" "]] .. scriptFile .. [[" "]] .. props['WindowID'] .. [["]] -- testing stuff :) 
        local cmd = [[start /b "" "]] .. interpreter .. [[" "]] .. scriptFile .. [["]]
        
        -- Debug Print. Remove it if unneeded
        print("> DBG: Launching: " .. cmd)
        
        os.execute(cmd)
    else
        -- Clean up handles here, if only one file was found
        if f1 then f1:close() end
        if f2 then f2:close() end
        print("![ERROR] scite_overlaytab startup Failed: Check paths for AutoIt and/or the script (" .. interpreter .. ") (" .. scriptFile .. ")")
    end
end

and that will load the script when SciTE loads :)

Spoiler

I'll be running this everywhere so I made a function to add itself to SciTE.
It'll make it easier to update too when a new version comes along.

...
_Singleton(@ScriptName)

AddToLUA()
Func AddToLUA()
    Local $sAutoit3Root = StringLeft(@AutoItExe, StringInStr(@AutoItExe, "\", 0, -1) - 1)
    Local $sFlagName = "sciteOverlaytab.startup.ran"
    Local $iData, $aData, $sData, $sStr, $sFilename = @LocalAppDataDir & "\AutoIt v3\SciTE\PersonalTools.lua"
    If FileGetSize($sFilename) Then
        $sData = FileRead($sFilename)
        If Not StringInStr($sData, $sFlagName) Then
            ConsoleWrite($sFilename & @CRLF)
            If Not FileGetSize($sAutoit3Root & "\Extras\scite_overlaytab\" & @ScriptName) Then
                FileCopy(@ScriptFullPath, $sAutoit3Root & "\Extras\scite_overlaytab\" & @ScriptName, 9)
            EndIf

            $sStr = "" & @CRLF
            $sStr &= "function PersonalTools:OnStartup()" & @CRLF
            $sStr &= "" & @CRLF
            $sStr &= "    -- scite_overlaytab - start of ()" & @CRLF
            $sStr &= "    -- Run once per session ""flag"" from the ""SciTEUser.properties"" entry" & @CRLF
            $sStr &= "    if props['" & $sFlagName & "'] == '1' then return end" & @CRLF
            $sStr &= "    props['" & $sFlagName & "'] = '1'" & @CRLF
            $sStr &= "" & @CRLF
            $sStr &= "" & @CRLF
            $sStr &= "    -- Paths go here" & @CRLF
            $sStr &= "    local sciteDir = props['SciteDefaultHome']" & @CRLF
            $sStr &= "    local interpreter = sciteDir .. ""\\..\\AutoIt3_x64.exe""" & @CRLF
            $sStr &= "    local scriptFile = sciteDir .. ""\\..\\Extras\\scite_overlaytab\\" & @ScriptName & """" & @CRLF
            $sStr &= "    " & @CRLF
            $sStr &= "    -- FileExists() check" & @CRLF
            $sStr &= "    local f1 = io.open(interpreter, ""r"")" & @CRLF
            $sStr &= "    local f2 = io.open(scriptFile, ""r"")" & @CRLF
            $sStr &= "    " & @CRLF
            $sStr &= "    if f1 and f2 then" & @CRLF
            $sStr &= "        f1:close()" & @CRLF
            $sStr &= "        f2:close()" & @CRLF
            $sStr &= "        " & @CRLF
            $sStr &= "        -- Build the command to run:" & @CRLF
            $sStr &= "        -- local cmd = [[start /b "" ""]] .. interpreter .. [["" ""]] .. scriptFile .. [["" ""]] .. props['WindowID'] .. [[""]] -- testing stuff :) " & @CRLF
            $sStr &= "        local cmd = [[start /b """" ""]] .. interpreter .. [["" ""]] .. scriptFile .. [[""]]" & @CRLF
            $sStr &= "        " & @CRLF
            $sStr &= "        -- Debug Print. Remove it if unneeded" & @CRLF
            $sStr &= "        print(""> DBG: Launching: "" .. cmd)" & @CRLF
            $sStr &= "" & @CRLF
            $sStr &= "        os.execute(cmd)" & @CRLF
            $sStr &= "    else" & @CRLF
            $sStr &= "        -- Clean up handles here, if only one file was found" & @CRLF
            $sStr &= "        if f1 then f1:close() end" & @CRLF
            $sStr &= "        if f2 then f2:close() end" & @CRLF
            $sStr &= "        print(""![ERROR] scite_overlaytab startup Failed: Check paths for AutoIt and/or the script ("" .. interpreter .. "") ("" .. scriptFile .. "")"")" & @CRLF
            $sStr &= "    end" & @CRLF
            $sStr &= "end" & @CRLF
            $sStr &= "" & @CRLF
            FileWriteLine($sFilename, $sStr)
        ElseIf Not StringInStr($sData, "\\Extras\\scite_overlaytab\\" & @ScriptName) Then
            ConsoleWrite('+ update: ' & $sFilename & @CRLF)
            $sStr = ""
            $aData = StringSplit($sData, @CRLF, 1)
            For $iData = 1 To $aData[0]
                If StringInStr($aData[$iData], "\\Extras\\scite_overlaytab\\") Then
                    $aData[$iData] = '    local scriptFile = sciteDir .. "\\..\\Extras\\scite_overlaytab\\' & @ScriptName & '"'
                EndIf
                $sStr &= $aData[$iData] & @CRLF
            Next
            FileRecycle($sFilename)
            FileWriteLine($sFilename, $sStr)
        EndIf
    EndIf

    $sStr = @CRLF & "# scite_overlaytab - Initialize a startup flag to use in ""PersonalTools.lua""" & @CRLF
    $sStr &= $sFlagName & "=0"

    $sFilename = $sAutoit3Root & "\SciTE\SciTEUser.properties"
    If FileGetSize($sFilename) And Not StringInStr(FileRead($sFilename), $sFlagName) Then
        ConsoleWrite($sFilename & @CRLF)
        FileWriteLine($sFilename, $sStr)
    EndIf

    $sFilename = @LocalAppDataDir & "\AutoIt v3\SciTE\SciTEUser.properties"
    If FileGetSize($sFilename) And Not StringInStr(FileRead($sFilename), $sFlagName) Then
        ConsoleWrite($sFilename & @CRLF)
        FileWriteLine($sFilename, $sStr)
    EndIf

EndFunc   ;==>AddToLUA
...

 

..also, I run more than just the latest version so this is easier this way:

;~ from: #include <WindowsStylesConstants.au3>
Global Const $WS_POPUP = 0x80000000
Global Const $WS_EX_TOOLWINDOW = 0x00000080
Global Const $WS_EX_NOACTIVATE = 0x08000000
Global Const $WS_EX_TRANSPARENT = 0x00000020

 


 

Edited by argumentum

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting  image.gif.922e3a93535f431de08b31ee669cc446.gif
autoit_scripter_blue_userbar.png

Posted (edited)
13 hours ago, argumentum said:

.that thinking about it, I should look at SciTE's LUAs and make it run this on load instead of the "stay in the tray" I did 🤔

if you use the SciTE_PlusBar , the easiest way is to drop it into the  SciTE_PlusBar\SciTE\AUTOEXEC  folder

 

13 hours ago, argumentum said:

..that way the purple bar's size is dynamic and looks about the same ( give or take a pixel ) when I move the editor from one monitor to the other :)

Version: 12

  • Feature: Architecture Selector: Runs on x86 or x64 depending on SciTE.

  • Feature: State Management: Two colors  (Purple, Ctrl+Shift+6 | Green, Ctrl+Shift+7)  with smart toggle/switch.

  • Feature: Proportional UI: The "Significant" line breathes with the Tab, change from 3 pixels to 0.15 ratio

  • Performance: change the default to PROCESS_DPI_UNAWARE -1  ->  PROCESS_SYSTEM_DPI_AWARE -2

Edited by ioa747

I know that I know nothing

Posted (edited)
...
Func _ToggleSignificant()
    ; If Not WinActive(" SciTE CLASS ") Then Return "because we're elsewhere" ; <<<<
    If Not WinActive("[CLASS:SciTEWindow;]") Then Return ; ..the above was lazy on my part 😅
    Local $hTab = ControlGetHandle($g_SciTE_Handle, "", "SciTeTabCtrl1")
...

That was nice !. Like the new version :) 

Edited by argumentum
better

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting  image.gif.922e3a93535f431de08b31ee669cc446.gif
autoit_scripter_blue_userbar.png

Posted (edited)

What do you think about an approach that reads the tabs from the Buffers menu?
This solves three problems

  • The problem of files marked as Significant and having the same name but in a different folder
    (because we only had the name as id, not the path)
     
  • and the issue of the instability of _SciTE_GetTabText, because now _SciTE_GetTabText will not be needed
    (although it seems to have been solved) 
     
  • and the issue that if some script is running, scite's OpenFileLocation is disabled (Ctrl+E)

 

Update to Version 1.0

 

Please, every comment is appreciated!
leave your comments and experiences here!
Thank you very much  :)

 

Edited by ioa747

I know that I know nothing

Posted (edited)
9 hours ago, ioa747 said:

This solves three problems

..yes, I made 2 new scripts "New AutoIt v3 Script.au3" and yes, it now does what's expected :)

9 hours ago, ioa747 said:

..if some script is running, scite's OpenFileLocation is disabled (Ctrl+E)

..and Ctrl+j ( jump to function) and any LUA script because there is a LUA function executing 🤔

Now, if we HotKeySet("^e", "MyFunction") , that Ctrl+E is applied to the whole session, therefore if not in SciTE we'd need to disable the HotKey, send() and HotKeySet again so that if am in a chrome browser and want to search (Ctrl+E) works 🤪

Spoiler
...
Func _OpenFileLocation()
    If Not WinActive($g_SciTE_Handle) Then
        HotKeySet("^e")
        Send("^e")
        HotKeySet("^e", "_OpenFileLocation")
        Return
    EndIf
    Run('explorer.exe /select, "' & $g_aItems[$g_iActive][0] & '"')
EndFunc
...

If we make the wrapper that runs the script(s) exit the LUA, and still have a way to force close the script(s), then we have a solution for all the LUA triggers in the editor ;)

But yes, the new buffer thing is much better. Thanks :) 

Edited by argumentum

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting  image.gif.922e3a93535f431de08b31ee669cc446.gif
autoit_scripter_blue_userbar.png

Posted
14 minutes ago, argumentum said:

...and any LUA script because there is a LUA function executing 🤔

the "Stop executing" is grayed out when not in use. Then is the only one not grayed out. So maybe is a "workflow decision" when coding the wrapper.
My assumption in regards on how it works is just an assumption 😅

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting  image.gif.922e3a93535f431de08b31ee669cc446.gif
autoit_scripter_blue_userbar.png

  • 2 months later...
Posted (edited)
12 hours ago, argumentum said:

as is works on the 1st one with all feature but not on the 2nd one. Any way around that 🙏

That is why, in my version, I have identified the active SciTE window handle. I think that should be implemented in the ‘_SciTE_ArchSlector()’ function.

Func __GetHwnd_SciTE()
    Local $hScite = WinGetHandle('[ACTIVE]')
    If _WinAPI_GetClassName($hScite) = 'SciTEWindow' Then
        Return $hScite
    Else
        Return SetError(1, 0, Null)
    EndIf
EndFunc

 

EDIT:

I’ve now read the code from start to finish. The function above doesn't solve the problem. What to do:

You need an array or a map to store (potential) SciTE handles. In this context, you must save the current state of the selected tabs.
Furthermore, it is necessary to continuously check whether a SciTE instance is currently active, and if so, which one. When an instance is closed, the data is deleted from the array or map. What is required, therefore, is an instance handler that stores the tab data and switches between instances.
That is what I did in my project within the function “_CheckSciTE()”.

That’s what I think on the matter.

Edited by BugFix

Best Regards BugFix  

Posted

in "Version 5.5.6   Scintilla:5.5.6   Lexilla:5.4.4    Jun  5 2025 10:01:05"

added:
# scite_overlaytab - Initialize a startup flag to use in "PersonalTools.lua"
sciteOverlaytab.startup.ran=0

to SciTEUser.properties

then in "PersonalTools.lua" added:

function PersonalTools:OnStartup()

    -- Run once per session "flag" from the "SciTEUser.properties" entry
    if props['sciteOverlaytab.startup.ran'] == '1' then return end
    props['sciteOverlaytab.startup.ran'] = '1'


    -- Paths go here
    local sciteDir = props['SciteDefaultHome']
    local interpreter = sciteDir .. "\\..\\AutoIt3_x64.exe"
    local scriptFile = sciteDir .. "\\..\\Extras\\scite_overlaytab\\scite_overlaytab_v1.1.au3"
    
    -- FileExists() check
    local f1 = io.open(interpreter, "r")
    local f2 = io.open(scriptFile, "r")
    
    if f1 and f2 then
        f1:close()
        f2:close()
        
        -- Build the command to run:
        -- local cmd = [[start /b "" "]] .. interpreter .. [[" "]] .. scriptFile .. [[" "]] .. props['WindowID'] .. [["]] -- testing stuff :) 
        local cmd = [[start /b "" "]] .. interpreter .. [[" "]] .. scriptFile .. [["]]
        
        -- Debug Print. Remove it if unneeded
        print("> DBG: Launching: " .. cmd)
        
        os.execute(cmd)
    else
        -- Clean up handles here, if only one file was found
        if f1 then f1:close() end
        if f2 then f2:close() end
        print("![ERROR] scite_overlaytab startup Failed: Check paths for AutoIt and/or the script (" .. interpreter .. ") (" .. scriptFile .. ")")
    end
end

But even running it from explorer, it's wrong 🤔

..it applies to the 1st one instead of the 2nd one

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting  image.gif.922e3a93535f431de08b31ee669cc446.gif
autoit_scripter_blue_userbar.png

Posted (edited)

The Explorer Fallback Trap
When you double-click the script from Explorer, Explorer is the active window.
The script's architecture selector sees that Explorer is not a SciTEWindow, so it falls back to: WinGetHandle('[CLASS:SciTEWindow]')
Windows API will always return the handle of the 1st SciTE instance created in the system, completely ignoring your 2nd window.

The Lua OnStartup Mistake
You are using OnStartup, which runs only once when the first SciTE opens.
When you open a 2nd SciTE window, OnStartup does not trigger again. Even if it did, your command is missing the $(WindowID) parameter.

The solution
either you will pass the correct scite handle as a parameter, when calling SciTE_OverlayTab.au3

or the ACTIVE window should be the correct scite window when calling SciTE_OverlayTab.au3

 

check the function Func _SciTE_ArchSlector() ; 🚧

Edited by ioa747

I know that I know nothing

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
×
×
  • Create New...