Jump to content

SciTE PlusBar


ioa747
 Share

Recommended Posts

@SOLVE-SMART  Thank you for your kind words.

I really appreciate your intention to support, as you did from the very beginning. 👍

As for the GitHub, I don't know it and it seems more chaotic to me, since it contains scripts from different languages.

I believe that anyone who  use, and love SciTE in combination with AutoIt  and deals with it will pass by here,

since this is the home of AutoIt . :)

This is also the reason why I am also here.  :guitar:

Thanks again for the interaction

I know that I know nothing

Link to comment
Share on other sites

Fair enough @ioa747 👍 .

1 minute ago, ioa747 said:

As for the GitHub, I don't know it and it seems more chaotic to me, since it contains scripts from different languages.

Yes it is not related to AutoIt like this forum, for sure. It wouldn't make seense to explain GitHub (from my point of view) to you.
If you did not needed it so far, it's totally okay. Let's see what the time brings 😀 .

6 minutes ago, ioa747 said:

I really appreciate your intention to support, as you did from the very beginning. 👍

You're welcome.

Best regards
Sven

Stay innovative!

Spoiler

🌍 Au3Forums

🎲 AutoIt (en) Cheat Sheet

📊 AutoIt limits/defaults

💎 Code Katas: [...] (comming soon)

🎭 Collection of GitHub users with AutoIt projects

🐞 False-Positives

🔮 Me on GitHub

💬 Opinion about new forum sub category

📑 UDF wiki list

✂ VSCode-AutoItSnippets

📑 WebDriver FAQs

👨‍🏫 WebDriver Tutorial (coming soon)

Link to comment
Share on other sites

Favorite.png  FavoriteMenu.au3

Favorite Menu for SciTE PusBar

; https://www.autoitscript.com/forum/topic/208404-scite-plusbar/?do=findComment&comment=1513490
;------------------------------------------------------------------------------
; Title...........: FavoriteMenu.au3
; Description.....: Favorite Menu for SciTE PusBar
;------------------------------------------------------------------------------
#NoTrayIcon
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=..\ICO\Favorite.ico
#AutoIt3Wrapper_Res_Description=Favorite Menu for SciTE PusBar
#AutoIt3Wrapper_Res_Fileversion=0.0.0.10
#AutoIt3Wrapper_Res_ProductName=FavoriteMenu.au3
#AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#include <GuiMenu.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
#include <ListBoxConstants.au3>
#include <GuiListBox.au3>
#include <StaticConstants.au3>
#include <ButtonConstants.au3>
;~ #include <Debug.au3>

Global $MyIni = StringTrimRight(@ScriptFullPath, 4) & ".ini"
Global $MyName = StringSplit($MyIni, "\", 1)

$MyName = $MyName[$MyName[0]]
$MyName = StringTrimRight($MyName, 4)

Global $mPos = MouseGetPos()
Global $hGui = GUICreate("Fav_gui", 32, 32, $mPos[0], $mPos[1], $WS_POPUP, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST, $WS_EX_NOACTIVATE))
GUISetBkColor("0x000000")
WinSetTrans($hGui, "", 2)

;Add FileChangeDir to set the workdir to the scriptdir
FileChangeDir(@ScriptDir)

Global $Scite_Hwnd = WinGetHandle("[CLASS:SciTEWindow]")
Global $aBox = BoxLoad()

#Region === ContextMenu ===
Global $hMenu = GUICtrlCreateContextMenu()

Global $Menu_Add = GUICtrlCreateMenuItem("➕  Add To " & $MyName, $hMenu)
Global $Menu_Remove = GUICtrlCreateMenuItem("➖  Remove From " & $MyName, $hMenu)
GUICtrlCreateMenuItem("", $hMenu)     ; separator   -------------------------------------
Global $Menu_Edit = GUICtrlCreateMenuItem("⚙  Edit " & $MyName, $hMenu)
GUICtrlCreateMenuItem("", $hMenu)     ; separator   -------------------------------------

For $i = 1 To $aBox[0][0]
    GUICtrlCreateMenuItem($aBox[$i][0], $hMenu)
Next

GUICtrlCreateMenuItem("", $hMenu)     ; separator   -------------------------------------
Global $Menu_Cancel = GUICtrlCreateMenuItem("Cancel", $hMenu)
#EndRegion === ContextMenu ===
GUISetState(@SW_SHOW)

;HotKeySet("{END}", "DisplayBox")
;~ If Not $CmdLine[0] Then
;~  ;
;~ Else
;~  MsgBox(4096, "$CmdLine[1]", $CmdLine[1])
;~ EndIf

; Perform a mouse right click
MouseClick("right")

Global $ID, $TmpSciteFile, $NeedSave = False
; Loop until the user exits.
;********************************************************************
While 1
    $ID = GUIGetMsg()
    Switch $ID
        Case $GUI_EVENT_CLOSE
            ExitLoop
        Case $Menu_Add
            $TmpSciteFile = SciTE_CurrentFile()
            If $TmpSciteFile Then AddToBox($TmpSciteFile)
            ExitLoop
        Case $Menu_Remove
            $TmpSciteFile = SciTE_CurrentFile()
            If $TmpSciteFile Then RemoveFromBox($TmpSciteFile)
            ExitLoop
        Case $Menu_Edit
            $TmpSciteFile = SciTE_CurrentFile()
            If $TmpSciteFile Then BoxEdit($TmpSciteFile)
            ExitLoop
        Case $Menu_Cancel
            ExitLoop
        Case 8 To $aBox[0][0] + 9
            ShellExecute($aBox[$ID - 8][1])
;~          RunFromBox($aBox[$ID - 8][1])
            ExitLoop
    EndSwitch

    If Not WinActive($hGui) Then
        ExitLoop
    EndIf

    Sleep(10)

WEnd
;********************************************************************
;~ Sleep(500) ;
ConsoleWrite("$NeedSave=" & $NeedSave & @CRLF)

If $NeedSave = True Then BoxSave()

GoToExit()
;----------------------------------------------------------------------------------------
Func GoToExit() ; exit
    Exit
EndFunc   ;==>GoToExit
;----------------------------------------------------------------------------------------
Func SciTE_CurrentFile($FullPath = 1) ; Return the Current Scite [0=ScriptName; 1=ScriptFullPath]

    Local $ClipBack = ClipGet() ; backup clip data

    WinMenuSelectItem("[CLASS:SciTEWindow]", "", "&File", "Copy Pat&h")

    Local $ScriptName, $ScriptFullPath = ClipGet()
    ConsoleWrite("$ScriptFullPath=" & $ScriptFullPath & @CRLF)

    If Not FileExists($ScriptFullPath) Then
        Return SetError(1, 0, "")
    EndIf

    If $FullPath = 0 Then
        Local $sSplit = StringSplit($ScriptFullPath, "\")
        $ScriptName = $sSplit[$sSplit[0]]
    Else
        $ScriptName = $ScriptFullPath
    EndIf

    ClipPut($ClipBack) ; Restore clip data

    Return $ScriptName

EndFunc   ;==>SciTE_CurrentFile
;----------------------------------------------------------------------------------------
Func BoxLoad() ; Ini Read
    Local $iniFileExists = FileExists($MyIni)
    Local $index = 0
    Local $aTMenu[1][2]
    $aTMenu[0][0] = $index
    $aTMenu[0][1] = "Path"

    ;Checks if FavoriteMenu.ini not exists then make one.
    If Not $iniFileExists Then
        ;Open the file for writing (append to the end of a file) and store the handle to a variable.
        Local $hFileOpen = FileOpen($MyIni, $FO_APPEND)
        If $hFileOpen = -1 Then
            MsgBox($MB_SYSTEMMODAL, "", "An error occurred while writing the " & $MyName & ".ini")
            GoToExit()
        EndIf

        ;Write data to the file using the handle returned by FileOpen.
        FileWrite($hFileOpen, "[Fav_1]" & @CRLF)
        FileWrite($hFileOpen, "Name=" & @ScriptName & @CRLF)
        FileWrite($hFileOpen, "Path=" & @ScriptFullPath & @CRLF)

        ;Close the handle returned by FileOpen.
        FileClose($hFileOpen)
        Sleep(300)
    EndIf

    ;Read the INI section names. This will return a 1 dimensional array.
    Local $aSections = IniReadSectionNames($MyIni)
    ;Check if an error occurred.
    If Not @error Then
        ;Enumerate through the array displaying the section names.
        For $i = 1 To $aSections[0]
            ReDim $aTMenu[UBound($aTMenu) + 1][2]
            $index += 1
            $aTMenu[0][0] = $index ; cnt
            $aTMenu[$index][0] = IniRead($MyIni, $aSections[$i], "Name", "default") ;Name
            $aTMenu[$index][1] = IniRead($MyIni, $aSections[$i], "Path", "default") ;Path
        Next
    EndIf

    Return $aTMenu

EndFunc   ;==>BoxLoad
;----------------------------------------------------------------------------------------
Func BoxSave() ; Save or Make new Ini file
    ;Read the INI section names. This will return a 1 dimensional array.
    Local $aSections = IniReadSectionNames($MyIni)
    ;Check if an error occurred.
    If Not @error Then
        ;Enumerate through the array displaying the section names.
        For $i = 1 To $aSections[0]
            ;Delete the sections
            IniDelete($MyIni, $aSections[$i])
        Next
    EndIf

    ;Write to the .ini
    If Not @error Then
        For $i = 1 To $aBox[0][0]
            IniWrite($MyIni, "Fav_" & $i, "Name", $aBox[$i][0])
            IniWrite($MyIni, "Fav_" & $i, "Path", $aBox[$i][1])
            ;ConsoleWrite($i & ") " & $aBox[$i][0] & @CRLF)
        Next
    EndIf
EndFunc   ;==>BoxSave
;----------------------------------------------------------------------------------------
Func AddToBox($sFilePath) ; Add to Box
    ; Search if $sFilePath exist (looking in col 2)
    Local $iIndex = _ArraySearch($aBox, $sFilePath, 0, 0, 0, 0, 1, 2)

    If $iIndex > 1 Then Return  ; if all redy exist then return
    Local $mName = StringSplit($sFilePath, "\")
    Local $sFill = $mName[$mName[0]] & "|" & $sFilePath

    _ArrayAdd($aBox, $sFill)

    $aBox[0][0] += 1
    $NeedSave = True
EndFunc   ;==>AddToBox
;----------------------------------------------------------------------------------------
Func RemoveFromBox($sFilePath) ; Remove from Box
    ; Search if $sFilePath exist (looking in col 2)
    Local $iIndex = _ArraySearch($aBox, $sFilePath, 0, 0, 0, 0, 1, 2)
    If $iIndex Then
        _ArrayDelete($aBox, $iIndex)
        $aBox[0][0] -= 1
        $NeedSave = True
    EndIf
EndFunc   ;==>RemoveFromBox
;----------------------------------------------------------------------------------------
Func BoxEdit($sCurrentSciteFile) ; Box Edit
    #Region === Create GUI ===
    Local $hGuiEdit = GUICreate("Edit " & $MyName, 550, 420, -1, -1, -1, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST, $WS_EX_ACCEPTFILES))
    Local $idListBox = GUICtrlCreateList("", 5, 0, 540, 330, BitOR($WS_VSCROLL, $WS_BORDER, $LBS_NOTIFY))
    GUICtrlSetFont(-1, 9)
    GUICtrlCreateLabel("Name:", 5, 330, 30, 10)
    GUICtrlSetFont(-1, 8)
    Local $Input_Name = GUICtrlCreateInput("Name", 5, 345, 460, 21)
    GUICtrlSetFont(-1, 9)
    GUICtrlCreateLabel("Path:", 5, 375, 30, 10)
    GUICtrlSetFont(-1, 8)
    Local $Input_Path = GUICtrlCreateInput("Path", 5, 390, 540, 21)
    GUICtrlSetFont(-1, 7)
    GUICtrlSetState($Input_Path, $GUI_DROPACCEPTED)
    Local $Button_Add = GUICtrlCreateButton("Add", 478, 323, 32, 32, $BS_ICON)
    GUICtrlSetImage(-1, "..\ICO\GUI\BTN_ADD.ico") ;  "mmcndmgr.dll", 30503)
    GUICtrlSetTip(-1, "Add Item")
    Local $Button_Remove = GUICtrlCreateButton("Remove", 478, 356, 32, 32, $BS_ICON)
    GUICtrlSetImage(-1, "..\ICO\GUI\BTN_SUB.ico") ;  "mmcndmgr.dll", 30536)
    GUICtrlSetTip(-1, "Remove Item")
    Local $Button_Up = GUICtrlCreateButton("Up", 513, 323, 32, 32, $BS_ICON)
    GUICtrlSetImage(-1, "..\ICO\GUI\BTN_UP2.ico") ; "mmcndmgr.dll", 30554)
    GUICtrlSetTip(-1, "Move UP")
    Local $Button_Down = GUICtrlCreateButton("Down", 513, 356, 32, 32, $BS_ICON)
    GUICtrlSetImage(-1, "..\ICO\GUI\BTN_DOWN2.ico") ; "mmcndmgr.dll", 30545)
    GUICtrlSetTip(-1, "Move DOWN")
    Local $Button_FileDlg = GUICtrlCreateButton("File", 360, 368, 51, 20)
    Local $Button_FolderDlg = GUICtrlCreateButton("Folder", 415, 368, 51, 20)
    GUISetState(@SW_SHOWNORMAL)
    #EndRegion === Create GUI ===
    #Region === ContextMenu ===
    Local $hBoxMenu = GUICtrlCreateContextMenu($idListBox)

    Local $Menu_Add = GUICtrlCreateMenuItem("Add Item ", $hBoxMenu)
    Local $Menu_Remove = GUICtrlCreateMenuItem("Remove Item ", $hBoxMenu)
    GUICtrlCreateMenuItem("", $hBoxMenu) ; separator    -------------------------------------
    Local $Menu_Up = GUICtrlCreateMenuItem("Move UP" & @TAB & "Shift ▲", $hBoxMenu)
    Local $Menu_Down = GUICtrlCreateMenuItem("Move DOWN" & @TAB & "Shift ▼", $hBoxMenu)
    GUICtrlCreateMenuItem("", $hBoxMenu) ; separator    -------------------------------------
    Local $Menu_Edit = GUICtrlCreateMenuItem("Edit ", $hBoxMenu)

    Local $GUI_AccelTable[2][2] = [["+{UP}", $Menu_Up], ["+{DOWN}", $Menu_Down]]
    GUISetAccelerators($GUI_AccelTable, $hGuiEdit)
    #EndRegion === ContextMenu ===

    Local $CurPos, $TmpPos, $AddNew, $mName

    ; Add strings
    _GUICtrlListBox_BeginUpdate($idListBox)
    For $i = 1 To $aBox[0][0]
        _GUICtrlListBox_AddString($idListBox, $aBox[$i][0])
    Next
    _GUICtrlListBox_EndUpdate($idListBox)

    ;ConsoleWrite("$aBox[0][0]=" & $aBox[0][0] & @CRLF)

    ; Search if $sCurrentSciteFile exist (looking in col 2)
    Local $iIndex = _ArraySearch($aBox, $sCurrentSciteFile, 0, 0, 0, 0, 1, 2)
    ;ConsoleWrite("$iIndex=" & $iIndex & @CRLF)
    If $iIndex > 0 Then
        _GUICtrlListBox_SetCurSel($idListBox, $iIndex - 1)
    Else
        _GUICtrlListBox_SetCurSel($idListBox, $aBox[0][0] - 1)
    EndIf

    $CurPos = _GUICtrlListBox_GetCurSel($idListBox)
    ;ConsoleWrite("StartPos=" & $CurPos & @CRLF)

    ; Get currently selected item
    GUICtrlSetData($Input_Name, $aBox[_GUICtrlListBox_GetCurSel($idListBox) + 1][0])
    GUICtrlSetData($Input_Path, $aBox[_GUICtrlListBox_GetCurSel($idListBox) + 1][1])
    GUICtrlSetTip($Input_Path, $aBox[$CurPos + 1][1])

    ; Loop until the user exits.
    While 1
        If $CurPos <> $TmpPos Then
            $TmpPos = $CurPos
            ;ConsoleWrite("$CurPos=" & $CurPos & @CRLF)
        EndIf

        $ID = GUIGetMsg()
        Switch $ID
            Case $GUI_EVENT_CLOSE
                ExitLoop
            Case $idListBox
                ;ConsoleWrite("-- $idListBox" & @CRLF)
                ; Get currently selected item
                $CurPos = _GUICtrlListBox_GetCurSel($idListBox)
                GUICtrlSetData($Input_Name, $aBox[$CurPos + 1][0])
                GUICtrlSetData($Input_Path, $aBox[$CurPos + 1][1])
                GUICtrlSetTip($Input_Path, $aBox[$CurPos + 1][1])
                If $AddNew = True Then
                    $AddNew = False
                    GUICtrlSetState($Input_Name, $GUI_FOCUS)
                    GUICtrlSetTip($Input_Path, "Select or Drop file or folder")
                    Send("^a")
                EndIf
            Case $Input_Name
                ;ConsoleWrite("-- $Input_Name" & @CRLF)
                $aBox[$CurPos + 1][0] = GUICtrlRead($Input_Name)
                _GUICtrlListBox_ReplaceString($idListBox, $CurPos, $aBox[$CurPos + 1][0])
                $NeedSave = True
            Case $Input_Path
                ;ConsoleWrite("-- $Input_Path" & @CRLF)
                $aBox[$CurPos + 1][1] = GUICtrlRead($Input_Path)
                $NeedSave = True
            Case $Button_FileDlg
                ;ConsoleWrite("-- $Button_FileDlg" & @CRLF)
                GUISetState(@SW_HIDE, $hGuiEdit)
                Local $sFileOpenDialog = FileOpenDialog("Select to add in " & $MyName, @ScriptDir & "\", "AutoIT (*.au3)", BitOR($FD_FILEMUSTEXIST, $FD_PATHMUSTEXIST))
                If @error Then
                    MsgBox(4096, "Error", "No file was selected.")
                Else
                    GUICtrlSetData($Input_Path, $sFileOpenDialog)
                    GUICtrlSetTip($Input_Path, $sFileOpenDialog)
                    $aBox[$CurPos + 1][1] = $sFileOpenDialog
                    $mName = StringSplit($sFileOpenDialog, "\")
                    GUICtrlSetData($Input_Name, $mName[$mName[0]])
                    $aBox[$CurPos + 1][0] = $mName[$mName[0]]
                    _GUICtrlListBox_ReplaceString($idListBox, $CurPos, $mName[$mName[0]])
                    $NeedSave = True
                EndIf
                GUISetState(@SW_SHOW, $hGuiEdit)
                $NeedSave = True
            Case $Button_FolderDlg
                ;ConsoleWrite("-- $Button_FolderDlg" & @CRLF)
                GUISetState(@SW_HIDE, $hGuiEdit)
                Local $sFileSelectFolder = FileSelectFolder("Select to add in Favorite", @ScriptDir & "\")
                If @error Then
                    MsgBox(4096, "Error", "No folder was selected.")
                Else
                    GUICtrlSetData($Input_Path, $sFileSelectFolder)
                    GUICtrlSetTip($Input_Path, $sFileSelectFolder)
                    $aBox[$CurPos + 1][1] = $sFileSelectFolder
                    $mName = StringSplit($sFileSelectFolder, "\")
                    GUICtrlSetData($Input_Name, $mName[$mName[0]])
                    $aBox[$CurPos + 1][0] = $mName[$mName[0]]
                    _GUICtrlListBox_ReplaceString($idListBox, $CurPos, $mName[$mName[0]])
                    $NeedSave = True
                EndIf
                GUISetState(@SW_SHOW, $hGuiEdit)
                $NeedSave = True
            Case $Button_Add, $Menu_Add
                ;ConsoleWrite("-- $Button_Add" & @CRLF)
                Local $sFill = "<Name>|<Path>"
                If $CurPos < $aBox[0][0] - 1 Then
                    ; Insert item delimited string - inserted as 1 row - other rows filled with ""
                    _ArrayInsert($aBox, $CurPos + 1, $sFill)
                    _GUICtrlListBox_InsertString($idListBox, "<Name>", $CurPos)
                    _GUICtrlListBox_ClickItem($idListBox, $CurPos, "left")
                Else
                    _ArrayAdd($aBox, $sFill)
                    _GUICtrlListBox_AddString($idListBox, "<Name>")
                    _GUICtrlListBox_ClickItem($idListBox, $CurPos + 1, "left")
                EndIf
                $aBox[0][0] += 1
                $AddNew = True
                $NeedSave = True
            Case $Button_Remove, $Menu_Remove
                ;ConsoleWrite("-- $Button_Remove" & @CRLF)
                _GUICtrlListBox_DeleteString($idListBox, $CurPos)
                _ArrayDelete($aBox, $CurPos + 1)
                $aBox[0][0] -= 1
                If $CurPos = $aBox[0][0] - 1 Then $CurPos -= 1
                If $CurPos > 0 Then
                    _GUICtrlListBox_ClickItem($idListBox, $CurPos - 1, "left")
                Else
                    _GUICtrlListBox_ClickItem($idListBox, 0, "left")
                EndIf
                $NeedSave = True
            Case $Button_Up, $Menu_Up
                ;ConsoleWrite("-- $Button_Up" & @CRLF)
                If $CurPos > 0 Then
                    ;ConsoleWrite("$aBox[" & $CurPos + 1 & "][0]=" & $aBox[$CurPos + 1][0] & @CRLF)
                    _ArraySwap($aBox, $CurPos + 1, $CurPos)
                    _GUICtrlListBox_SwapString($idListBox, $CurPos, $CurPos - 1)
                    $CurPos -= 1
                    _GUICtrlListBox_SetCurSel($idListBox, $CurPos)
                    $NeedSave = True
                EndIf
            Case $Button_Down, $Menu_Down
                ;ConsoleWrite("-- $Button_Down" & @CRLF)
                If $CurPos < $aBox[0][0] - 1 Then
                    ;ConsoleWrite("$aBox[" & $CurPos + 1 & "][0]=" & $aBox[$CurPos + 1][0] & @CRLF)
                    _ArraySwap($aBox, $CurPos + 1, $CurPos + 2)
                    _GUICtrlListBox_SwapString($idListBox, $CurPos, $CurPos + 1)
                    $CurPos += 1
                    _GUICtrlListBox_SetCurSel($idListBox, $CurPos)
                    $NeedSave = True
                EndIf
            Case $GUI_EVENT_DROPPED
                If @GUI_DropId = $Input_Path Then
                    ; SetImage ico file to $ICON_Drop label
                    GUICtrlSetData($Input_Path, @GUI_DragFile)
                    GUICtrlSetTip($Input_Path, @GUI_DragFile)
                    $aBox[$CurPos + 1][1] = @GUI_DragFile
                    $mName = StringSplit(@GUI_DragFile, "\")
                    GUICtrlSetData($Input_Name, $mName[$mName[0]])
                    $aBox[$CurPos + 1][0] = $mName[$mName[0]]
                    _GUICtrlListBox_ReplaceString($idListBox, $CurPos, $mName[$mName[0]])
                    $NeedSave = True
                EndIf

            Case $Menu_Edit
                ShellExecute($aBox[$CurPos + 1][1])
                ExitLoop

        EndSwitch
        Sleep(10)
    WEnd
    GUIDelete()
EndFunc   ;==>BoxEdit
;----------------------------------------------------------------------------------------
Func DisplayBox() ; _DebugArrayDisplay
    _ArrayDisplay($aBox)
EndFunc   ;==>DisplayBox
;----------------------------------------------------------------------------------------
Func RunFromBox($FilePath) ; Run From Box
    ConsoleWrite($FilePath & @CRLF)
    Run(FileGetShortName(@AutoItExe) & " " & FileGetShortName($FilePath) & "")
EndFunc   ;==>RunFromBox
;----------------------------------------------------------------------------------------

 

Back to first post

 

Edited by ioa747
UpDate to Version 0.0.0.10

I know that I know nothing

Link to comment
Share on other sites

UpDate: to  SciTE_PlusBar_1.0.0.25 (look in first post)

I moved the Make new profile sub-processes to editor
I kept unnecessary redraw to a minimum, to avoid some flickering effect
I adjusted the limits to the size of the bar (more here  https://www.autoitscript.com/forum/topic/209532 )
commented console output, and a general arrangement in the code

For anything, suggestions, comments, please post it to the thread
thank you very much :)

Edited May 14, 2023 by ioa747
The last edition in the first post
Back to first post

Edited by ioa747
UpDate

I know that I know nothing

Link to comment
Share on other sites

PutTxtVarFromClip.png  PutTxtVarFromClip.au3

Put the Clipboard text as $sTxt variable

The idea came to me a few days ago from this post 209881-capturing-empty-data-and-adding-text
because I needed to convert the text into a variable to post it (in the end I didn't do it, and replaced it with ClipGet() )

inspiration from @Gianni in the post   - Thanks for that

; https://www.autoitscript.com/forum/topic/208404-scite-plusbar/page/2/?tab=comments#comment-1515128
;------------------------------------------------------------------------------
; Title...........: PutTxtVarFromClip.au3
; Description.....: Put the Clipboard text as $sTxt variable
;------------------------------------------------------------------------------
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=..\ICO\PutTxtVarFromClip.ico
#AutoIt3Wrapper_Res_Description=Put the Clipboard text as $sTxt variable
#AutoIt3Wrapper_Res_Fileversion=0.0.0.1
#AutoIt3Wrapper_Res_ProductName=PutTxtVarFromClip.au3
#AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#include <WindowsConstants.au3>
#include <SendMessage.au3>

Global $ClipBack

If Not WinExists("[CLASS:SciTEWindow]") Then
    Exit
EndIf

$ClipBack = ClipGet() ; backup clip data

SciTE_PutTxtVarFromClip()

ClipPut($ClipBack) ; Restore clip data

;----------------------------------------------------------------------------------------
Func SciTE_PutTxtVarFromClip() ; Put the Clipboard text as $sTxt variable

    Local $hSciTE = WinActivate("[CLASS:SciTEWindow]")
    Local $hCtrlHnd = ControlGetFocus($hSciTE)
    $hCtrlHnd = ControlGetHandle($hSciTE, '', $hCtrlHnd)

    Local $sVarName = "$sTxt"
    Local $sListing = 'Local ' & $sVarName & ' = ""' & @CRLF
    Local $aStr = StringSplit(ClipGet(), @CRLF, 1) ;  get the clipboard content
    For $i = 1 To $aStr[0]
        $sListing &= $sVarName & ' &= "' & StringReplace($aStr[$i], '"', '""') & '" & @CRLF' & @CRLF
    Next

    ClipPut($sListing)
    _SendMessage($hCtrlHnd, $WM_PASTE)

EndFunc   ;==>SciTE_PutTxtVarFromClip
;--------------------------------------------------------------------------------------------

I am attaching the icon as well PutTxtVarFromClip.ico

Back to first post

Edited by ioa747
UpDate to Version 0.0.0.1

I know that I know nothing

Link to comment
Share on other sites

 CollorSX.png  CollorSX.au3

ShareX.exe -ColorPicker

for those who don't know !
ShareX is a free and open source program -  Screen capture, file sharing and productivity tool
ColorPicker   It is a separate tool of his where you can call it with ShareX.exe -ColorPicker

I use it Regularly, so I said to order in AutoIt services  :)

if you choose a color by double-clicking in scite on the hex color , you can then use get Get to get it, to see the color, or use Set to set it, change it
with  <-- button insert color name as comment, at the cursor position
 

; https://www.autoitscript.com/forum/topic/208404-scite-plusbar/page/2/?tab=comments#comment-1515180
;------------------------------------------------------------------------------
; Title...........: CollorSX.au3
; Description.....: ShareX.exe -ColorPicker
;------------------------------------------------------------------------------
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=..\ICO\CollorSX.ico
#AutoIt3Wrapper_Res_Description=ShareX.exe -ColorPicker
#AutoIt3Wrapper_Res_Fileversion=0.0.0.10
#AutoIt3Wrapper_Res_ProductName=CollorSX.au3
#AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#include <WindowsConstants.au3>
#include <SendMessage.au3>
#include <AutoItConstants.au3>
#include <GUIConstantsEx.au3>
#include <EditConstants.au3>
#include <StringConstants.au3>

Global $ClipBack, $ClipData, $hSciTE, $hCtrlHnd, $hShareX, $ShareX_Pos, $iState, $ColorName
Global $hGhostGUI, $idButtonGet, $idButtonSet, $idColorName, $idButtonCopyTxt, $ActStatus, $TmpStatus, $HexColor

If Not WinExists("[CLASS:SciTEWindow]") Then
    Exit
EndIf

; copy selected text from SciTE
$ClipBack = ClipGet() ; backup clip data
$hSciTE = WinActivate("[CLASS:SciTEWindow]")
$hCtrlHnd = ControlGetFocus($hSciTE)
$hCtrlHnd = ControlGetHandle($hSciTE, '', $hCtrlHnd)
_SendMessage($hCtrlHnd, $WM_COPY)
$ClipData = ClipGet()


LoadShareX("C:\Program Files\ShareX\ShareX.exe")


$hShareX = WinWait("ShareX - Color picker")
WinActivate($hShareX)
ControlClick($hShareX, "", "[NAME:btnClipboardColorPicker]")
$ColorName = ControlGetText($hShareX, "", "[NAME:lblNameValue]")

$ShareX_Pos = WinGetPos($hShareX)

; get the ShareX win color
$HexColor = PixelGetColor($ShareX_Pos[0] + 550, $ShareX_Pos[1] + 50)
$HexColor = "0x" & Hex($HexColor, 6)

ClipPut($ClipBack) ; Restore backup clip data
; Set the ShareX window as being ontop
ConsoleWrite("$WinOnTop=" & WinSetOnTop($hShareX, "", $WINDOWS_ONTOP) & @CRLF)

$hGhostGUI = GUICreate('GhostGUI', 210, 43, $ShareX_Pos[0] + 475, $ShareX_Pos[1] + 320, $WS_POPUP, $WS_EX_TOOLWINDOW, $hShareX)
GUISetBkColor($HexColor)

$idColorName = GUICtrlCreateEdit($ColorName, 3, 1, 180, 19, $ES_CENTER)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x272727)

$idButtonCopyTxt = GUICtrlCreateButton("<--", 183, 0, 24, 21)

$idButtonGet = GUICtrlCreateButton("Get", 3, 23, 100, 20)
$idButtonSet = GUICtrlCreateButton("Set", 107, 23, 100, 20)

; Display the GUI.
GUISetState(@SW_SHOW, $hGhostGUI)
WinActivate($hShareX)

;Yellow 0xFFFF00 ;Gray 0x7E7E7E ;Goldenrod 0xE39024 ;Lawn green  0x75DC19  ;Dark slate gray 0x063549

;*********************************************************************
While WinExists($hShareX)

    If Not WinExists($hSciTE) Then
        Exit
    EndIf

    ; Retrieve the state of the ShareX window
    $iState = WinGetState($hShareX)

    Switch $iState
        Case 7, 15
            $ActStatus = @SW_SHOW
        Case 5, 23
            $ActStatus = @SW_HIDE
    EndSwitch

    If $ActStatus <> $TmpStatus Then
        ;ConsoleWrite("$iState=" & $iState & @CRLF)
        GUISetState($ActStatus, $hGhostGUI)
        $TmpStatus = $ActStatus
        If $ActStatus = @SW_SHOW Then
            WinActivate($hShareX)
            $HexColor = "0x" & ControlGetText($hShareX, "", "[NAME:txtHex]")
            $ColorName = ControlGetText($hShareX, "", "[NAME:lblNameValue]")
            ConsoleWrite("# " & $HexColor & " ; " & $ColorName & @CRLF)
            GUICtrlSetData($idColorName, $ColorName)
        EndIf
    EndIf

    If WinActive($hShareX) Then
        $ShareX_Pos = WinGetPos($hShareX)
        WinMove($hGhostGUI, "", $ShareX_Pos[0] + 475, $ShareX_Pos[1] + 320)
        $ColorName = ControlGetText($hShareX, "", "[NAME:lblNameValue]")
        If $ColorName <> GUICtrlRead($idColorName) Then
            GUICtrlSetData($idColorName, $ColorName)
        EndIf
    EndIf

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop

        Case $idButtonCopyTxt
            $ClipBack = ClipGet()     ; backup clip data
            ClipPut(";" & GUICtrlRead($idColorName))
            WinActivate($hSciTE)
            _SendMessage($hCtrlHnd, $WM_PASTE)
            Global $SpaceCnt = 2
            StringReplace(ClipGet(), " ", " ", 0, $STR_CASESENSE)
            If @extended >= 1 Then
                $SpaceCnt += @extended
            EndIf

            Send("+^{LEFT " & $SpaceCnt & "}")
            ClipPut($ClipBack)        ; Restore backup clip data

        Case $idButtonGet
            $ClipBack = ClipGet()    ; backup clip data
            _SendMessage($hCtrlHnd, $WM_COPY)
            ControlClick($hShareX, "", "[NAME:btnClipboardColorPicker]")
            $HexColor = "0x" & ControlGetText($hShareX, "", "[NAME:txtHex]")
            $ColorName = ControlGetText($hShareX, "", "[NAME:lblNameValue]")
            ConsoleWrite("- Get " & $HexColor & " ; " & $ColorName & @CRLF)
            GUICtrlSetData($idColorName, $ColorName)
            ClipPut($ClipBack)        ; Restore backup clip data

        Case $idButtonSet
            $ClipBack = ClipGet()     ; backup clip data
            $HexColor = "0x" & ControlGetText($hShareX, "", "[NAME:txtHex]")
            $ColorName = ControlGetText($hShareX, "", "[NAME:lblNameValue]")
            ClipPut($HexColor)
            WinActivate($hSciTE)
            _SendMessage($hCtrlHnd, $WM_PASTE)
            Send("+^{LEFT}")
            ConsoleWrite("+ Set " & $HexColor & " ; " & $ColorName & @CRLF)
            GUICtrlSetData($idColorName, $ColorName)
            ClipPut($ClipBack)        ; Restore backup clip data

    EndSwitch

    Sleep(10)
WEnd
;*********************************************************************

Exit

;----------------------------------------------------------------------------------------
Func LoadShareX($sFullPath)
    If Not WinExists("ShareX - Color picker") Then
        If Not FileExists($sFullPath) Then $sFullPath = @ScriptDir & "\ShareX.exe"
        If Not FileExists($sFullPath) Then $sFullPath = @ScriptDir & "\ShareX\ShareX.exe"
        If Not FileExists($sFullPath) Then Exit MsgBox(262144, StringTrimRight(@ScriptName, 4), "Kindly tell the script where to find ShareX.exe, bye now.", 10)
        Run('"' & $sFullPath & '" -ColorPicker')
    EndIf
EndFunc   ;==>LoadShareX

 

it will definitely be included in the SciTE PusBar

 

 

I am attaching the icon as well CollorSX.ico

Back to first post

Edited by ioa747
UpDate to Version 0.0.0.10

I know that I know nothing

Link to comment
Share on other sites

The first time it runs the SciTE PlusBar the Configuration window appears

 

Configuration1.png

which, in addition to the adjustments it makes regarding the position of  PlusBar,
every time it appear, it checks if there is a relevant shortcut,

in this case SciTE_PlusBar.execute.lnk in the folder SciTE_PlusBar_1.0.0.25\SciTE\
and if not there then make one

Which shortcut (SciTE_PlusBar.execute.lnk) I have copied on the desktop,
I use it to call the SciTE

 

 

 

 

 

menu_conf.png

 

 

You can also call  Configuration
from the main menu
by clicking on the gear

 

 

 

Back to first post

Edited by ioa747

I know that I know nothing

Link to comment
Share on other sites

  • 2 weeks later...

PutSelectedInRegion2.png  PutSelectedInRegion.au3

Put the Selected text in a Region

 as the title says, put the selected text in a region for easily manageable blocks of code.

PS
to work normally, the status bar must be active
    status bar it is not necessary anymore, thanks to @bladem2003

; https://www.autoitscript.com/forum/topic/208404-scite-plusbar/page/2/#comment-1517023
;------------------------------------------------------------------------------
; Title...........: PutSelectedInRegion.au3
; Description.....: Put the Selected text in a Region
;------------------------------------------------------------------------------
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=..\ICO\PutSelectedInRegion2.ico
#AutoIt3Wrapper_Res_Description=Put the Selected text in a Region
#AutoIt3Wrapper_Res_Fileversion=0.0.0.10
#AutoIt3Wrapper_Res_ProductName=PutSelectedInRegion.au3
#AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#include <WindowsConstants.au3>
#include <SendMessage.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>

Global $hScite_Editor_hWnd = ControlGetHandle("[CLASS:SciTEWindow]", '', '[CLASS:Scintilla; INSTANCE:1]')
Global $ClipBack, $ClipData

If Not WinExists("[CLASS:SciTEWindow]") Then
    Exit
EndIf

$ClipBack = ClipGet() ; backup clip data

SciTE_PutItInRegion()

ClipPut($ClipBack) ; Restore clip data

;----------------------------------------------------------------------------------------
Func SciTE_PutItInRegion()  ; Put It In Region

    Local $Line = _SciTE_GetSelectedLineNumber()
    Local $Column = 12

    _SendMessage($hScite_Editor_hWnd, $WM_COPY)
    Sleep(100) ; * <-
    Local $sClip = ClipGet()

    Local $sTxt = "#Region ===  ===" & @CRLF
    $sTxt &= $sClip & @CRLF
    $sTxt &= "#EndRegion ===  ===" & @CRLF

    ClipPut($sTxt)
    _SendMessage($hScite_Editor_hWnd, $WM_PASTE)

    SendSciTE_Command("goto:" & $Line & "," & $Column)

EndFunc   ;==>SciTE_PutItInRegion
;--------------------------------------------------------------------------------------------
Func SendSciTE_Command($sCmd)
    Opt("WinSearchChildren", 1)
    ; Get SciTE DirectorHandle
    Local $SciTE_hwnd = WinGetHandle("DirectorExtension")
    ;Local $WM_COPYDATA = 74
    Local $CmdStruct = DllStructCreate('Char[' & StringLen($sCmd) + 1 & ']')
    DllStructSetData($CmdStruct, 1, $sCmd)
    Local $COPYDATA = DllStructCreate('Ptr;DWord;Ptr')
    DllStructSetData($COPYDATA, 1, 1)
    DllStructSetData($COPYDATA, 2, StringLen($sCmd) + 1)
    DllStructSetData($COPYDATA, 3, DllStructGetPtr($CmdStruct))
    DllCall('User32.dll', 'None', 'SendMessage', 'HWnd', $SciTE_hwnd, _
            'Int', $WM_COPYDATA, 'HWnd', 0, _
            'Ptr', DllStructGetPtr($COPYDATA))
EndFunc   ;==>SendSciTE_Command
;----------------------------------------------------------------------------------------
Func _SciTE_GetSelectedLineNumber()
    Return _SciTE_GetLineFromPosition(_SciTE_GetCurrentPosition()) + 1
EndFunc   ;==>_SciTE_GetSelectedLineNumber
;----------------------------------------------------------------------------------------
Func _SciTE_GetCurrentPosition()
    Local Const $SCI_GETCURRENTPOS = 2008
    Return _SendMessage($hScite_Editor_hWnd, $SCI_GETCURRENTPOS)
EndFunc   ;==>_SciTE_GetCurrentPosition
;----------------------------------------------------------------------------------------
Func _SciTE_GetLineFromPosition($iLineNumber)
    Local Const $SCI_LINEFROMPOSITION = 2166
    Return _SendMessage($hScite_Editor_hWnd, $SCI_LINEFROMPOSITION, $iLineNumber)
EndFunc   ;==>_SciTE_GetLineFromPosition
;----------------------------------------------------------------------------------------

I am attaching the icon as well PutSelectedInRegion.ico

Back to first post

Edited by ioa747
UpDate to Version 0.0.0.10

I know that I know nothing

Link to comment
Share on other sites

Hi, here is a small change suggestion, which will let the 1st time user to seek the scite.exe and write it into the ini file:

;Check if $ProcessStr is running else start it
Global $FindProcess
$FindProcess = 0
While $FindProcess = 0
    If Not ProcessExists($ProcessStr) Then
        If FileExists($Process_Path) Then
            Run($Process_Path)
            $FindProcess = 1
        Else
            $Process_Path = FileOpenDialog("Please locate the Autoit Scite.exe", @ScriptDir, "scite(scite.exe)", BitOR($FD_FILEMUSTEXIST, $FD_PATHMUSTEXIST), "scite.exe")

            If @error > 0 Then
                MsgBox($MB_SYSTEMMODAL, "Can't find " & $ProcessStr & " to start it", "Please, set the $Process_Path manually in Config.ini ")
                GoToExit()
            Else
                If StringInStr($Process_Path, "scite.exe") > 0 Then IniWrite(@ScriptDir & "\Config.ini", "Configuration", "Process_Path", $Process_Path)
            EndIf
        EndIf
    Else
        $FindProcess = 1
    EndIf
WEnd
$FindProcess = ""

#Region === Read Setting and Create Items ===

I have noticed that you are using the fixed path in the Func MakeExecuteShortcut:

; Create a shortcut
    FileCreateShortcut("C:\Program Files (x86)\AutoIt3\AutoIt3.exe", _  ;file

Not everyone is having the scite installed in the program files folder.

Edited by Dan_555
Bugfix: it is now running from the scite toolbar

Some of my script sourcecode

Link to comment
Share on other sites

@Dan_555  thanks for your suggestions and feedback

You are right about: not everyone is having the scite installed in the program files folder.

your suggestions are correct, but I will have to modify them (I don't know how yet)

because the plusbar, although it started for scite, but is not only for that

and from this I commit that there should be more general rules that fit for the other programs as well

Although it is still in the development stage, you can try it by selecting from the editor menu the command MakeNewProfile

open e.g. the notepad and press OK in the msgbox

Instructions coming soon

 

Thanks again for interaction :)

I know that I know nothing

Link to comment
Share on other sites

16 hours ago, ioa747 said:

PutSelectedInRegion.png  PutSelectedInRegion.au3

Put the Selected text in a Region

 as the title says, put the selected text in a region for easily manageable blocks of code.

PS
to work normally, the status bar must be active

; https://www.autoitscript.com/forum/topic/208404-scite-plusbar/page/2/#comment-1517023
;------------------------------------------------------------------------------
; Title...........: PutSelectedInRegion.au3
; Description.....: Put the Selected text in a Region
;------------------------------------------------------------------------------
#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7
#include <WindowsConstants.au3>
#include <SendMessage.au3>

Global $ClipBack, $ClipData, $hSciTE, $hCtrlHnd

If Not WinExists("[CLASS:SciTEWindow]") Then
    Exit
EndIf

$ClipBack = ClipGet() ; backup clip data

SciTE_PutItInRegion()

ClipPut($ClipBack) ; Restore clip data

;----------------------------------------------------------------------------------------
Func SciTE_PutItInRegion()  ; Put It In Region

    $hSciTE = WinActivate("[CLASS:SciTEWindow]")
    $hCtrlHnd = ControlGetFocus($hSciTE)
    $hCtrlHnd = ControlGetHandle($hSciTE, '', $hCtrlHnd)

    Local $pStart = SciTE_CurLine()
    Local $Line = $pStart[0]
    Local $Column = 12

    _SendMessage($hCtrlHnd, $WM_COPY)
    Local $sClip = ClipGet()

    Local $sTxt = "#Region ===  ===" & @CRLF
    $sTxt &= $sClip & @CRLF
    $sTxt &= "#EndRegion ===  ===" & @CRLF

    ClipPut($sTxt)
    _SendMessage($hCtrlHnd, $WM_PASTE)

    SendSciTE_Command("goto:" & $Line & "," & $Column)

EndFunc   ;==>SciTE_PutItInRegion
;--------------------------------------------------------------------------------------------
Func SciTE_CurLine()  ; 0=li    1=co
    WinActivate($hSciTE)

    Local $SciTE_li = [0, 0]
    Local $sbText = StatusbarGetText($hSciTE)
    Local $aTmp = StringSplit($sbText, " ")

    Local $cPage = StringSplit($aTmp[1], "=")
    $SciTE_li[0] = Int($cPage[2])

    $cPage = StringSplit($aTmp[2], "=")
    $SciTE_li[1] = Int($cPage[2])

    Return $SciTE_li

EndFunc   ;==>SciTE_CurLine
;--------------------------------------------------------------------------------------------
Func SendSciTE_Command($sCmd)
    Opt("WinSearchChildren", 1)
    ; Get SciTE DirectorHandle
    Local $SciTE_hwnd = WinGetHandle("DirectorExtension")
    ;Local $WM_COPYDATA = 74
    Local $CmdStruct = DllStructCreate('Char[' & StringLen($sCmd) + 1 & ']')
    DllStructSetData($CmdStruct, 1, $sCmd)
    Local $COPYDATA = DllStructCreate('Ptr;DWord;Ptr')
    DllStructSetData($COPYDATA, 1, 1)
    DllStructSetData($COPYDATA, 2, StringLen($sCmd) + 1)
    DllStructSetData($COPYDATA, 3, DllStructGetPtr($CmdStruct))
    DllCall('User32.dll', 'None', 'SendMessage', 'HWnd', $SciTE_hwnd, _
            'Int', $WM_COPYDATA, 'HWnd', 0, _
            'Ptr', DllStructGetPtr($COPYDATA))
EndFunc   ;==>SendSciTE_Command
;----------------------------------------------------------------------------------------

I am attaching the icon as well PutSelectedInRegion.ico

Back to first post

Hi, here is another way to get the line number selected in scite.
if you change the view in the status bar, no line number is displayed and you don't get the line number read out.

 

#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <SendMessage.au3>


Global $hScite_Editor_hWnd = ControlGetHandle("[CLASS:SciTEWindow]", '', '[CLASS:Scintilla; INSTANCE:1]')
MsgBox(0,"", _SciTE_GetSelectedLineNumber())

Func _SciTE_GetSelectedLineNumber()
    $hScite_Editor_hWnd = ControlGetHandle("[CLASS:SciTEWindow]", '', '[CLASS:Scintilla; INSTANCE:1]')
    Return _SciTE_GetLineFromPosition(_SciTE_GetCurrentPosition())
EndFunc   ;==>_SciTE_GetSelectedLineNumber


Func _SciTE_GetCurrentPosition()
    Local Const $SCI_GETCURRENTPOS = 2008
    Return _SendMessage($hScite_Editor_hWnd, $SCI_GETCURRENTPOS)
EndFunc   ;==>_SciTE_GetCurrentPosition


Func _SciTE_GetLineFromPosition($iLineNumber)
    Local Const $SCI_LINEFROMPOSITION = 2166
    Return _SendMessage($hScite_Editor_hWnd, $SCI_LINEFROMPOSITION, $iLineNumber)
EndFunc   ;==>_SciTE_GetLineFromPosition

 

Edited by bladem2003
Link to comment
Share on other sites

On 4/21/2023 at 8:59 PM, DuyMinh93 said:

can you give me your scite theme?


here is a quote from SciTEUser.properties

Spoiler

 

SciTEUser.properties

# Dark SciTE4AutoIt3 Color scheme
#------------------------------------------------------------
font.base=font:Cascadia Code,size:11
font.monospace=font:Courier New,size:11

# Background color
caret.line.back=#000000
caret.line.back.alpha=256
caret.fore=#FFFFFF
selection.fore=#C2FFAE
selection.alpha=100
selection.back=#4FA7FF

style.error.0=fore:#FF0000,back:#F0F0F0
style.error.1=fore:#FF0000,back:#C0C0C0
style.error.2=fore:#FFFFFF,back:#FF0000
highlight.current.word.colour=#C2FFAE
# NEEDED to fix global highlight in #forceref
highlight.current.word.by.style=0
# NEEDED to fix global highlight for simple variable as $a
highlight.current.word.minlength=2

# Calltips colors
style.au3.38=fore:#00D7D7,back:#282800
calltips.color.highlight=#e7db74

# 33 is used to display line numbers in the margin.
style.*.33=fore:#DADADA,back:#161d27  ,$(font.base)
# checkerboard pixel patter color 1 around fold trees
fold.margin.colour=#0D1117
# checkerboard pixel patter color 2 around fold trees
fold.margin.highlight.colour=#0D1117
# Color of symbol fill
fold.back=#0D1117

# indentation line
style.au3.37=fore:#0D1117

# Brace highlight
style.au3.34=fore:#84ACF0,back:#0D1117
# Brace incomplete highlight
style.au3.35=fore:#B2B2B2,back:#0D1117

# White space
style.au3.0=fore:#80C0FF,back:#0D1117
# Comment line
style.au3.1=fore:#B2B2B2,back:#0D1117
# Comment block
style.au3.2=fore:#B2B2B2,back:#0D1117
# Number
style.au3.3=fore:#00DDDD,back:#0D1117
# Function
style.au3.4=fore:#0096F0,back:#0D1117
# Keyword
style.au3.5=fore:#84ACF0,back:#0D1117
# Macro
style.au3.6=fore:#FF8000,back:#0D1117
# String
style.au3.7=fore:#D9CD79,back:#0D1117
# Operator
style.au3.8=fore:#FFAE5E,back:#0D1117
# Variable
style.au3.9=fore:#FFCEFF,back:#0D1117
# Send keys in string
style.au3.10=fore:#00B0B0,back:#0D1117
# Pre-Processor
style.au3.11=fore:#0080C0,back:#0D1117
# Special
style.au3.12=fore:#CB9898,back:#0D1117
# Abbrev-Expand
style.au3.13=fore:#FF80C0,back:#0D1117
# COM Objects
style.au3.14=fore:#CC68CC,back:#0D1117
# Standard UDF's
style.au3.15=fore:#9A65DC,back:#0D1117
# User UDF's as defined by au3.keywords.user.udfs= in au3.UserUdfs.properties
style.au3.16=fore:#DD4489,back:#0D1117

# ConsoleWrite output background color
style.*.32=fore:#D0D0D0,back:#0D1117,$(font.base)
# Actual consoleWrite output
style.errorlist.0=fore:#F9F9F9
# ConsoleWrite output highlighted
style.errorlist.3=fore:#FF0000
# starting with >
style.errorlist.4=fore:#32FFFF
# starting with !
style.errorlist.10=fore:#FF0000
# starting with +
style.errorlist.11=fore:#EA9515
# starting with - or <
style.errorlist.12=fore:#E6DB74
# starting with ---
style.errorlist.13=fore:#E87400
backup.files=0
proper.case=0
error.inline=1
highlight.current.word=1
highlight.current.word.autoselectword=0
highlight.current.word.wholeword=0
highlight.current.word.matchcase=0
use.tabs=1
indent.size=4
indent.size.*.au3=4
tabsize=4
indicators.alpha=63
calltips.set.above=1
visible.policy.strict=1
visible.policy.lines=0
command.name.19.*=
command.name.33.*=

style.errorlist.32=$(font.base),back:#0D1117
style.au3.32=style.*.32=$(font.base),back:#0D1117
title.full.path=1
#------------------------------------------------------------------------------

font  https://github.com/microsoft/cascadia-code 

 

 

Edited by ioa747
update

I know that I know nothing

Link to comment
Share on other sites

Hi,

i have made some small modification to the file so that whenever i open an au3 file the scite starts with the plusbar open.

i have edited the registry, pointing to the compiled _plusbar.exe instead of scite.exe

and this is the necessary modification:

;You probably also want to test whether the script is already running to avoid running it multiple times!
If _Singleton($SingletonStr, 1) = 0 Then
    If $CmdLineRaw > "" Then ShellExecute($Process_Path, $CmdLineRaw)
    Exit
EndIf

;Check if $ProcessStr is running else start it
Global $FindProcess
$FindProcess = 0
While $FindProcess = 0
    If Not ProcessExists($ProcessStr) Then
        If FileExists($Process_Path) Then
            ShellExecute($Process_Path, $CmdLineRaw)
            $FindProcess = 1
        Else
            $Process_Path = FileOpenDialog("Please locate the Autoit Scite.exe", @ScriptDir, "scite(scite.exe)", BitOR($FD_FILEMUSTEXIST, $FD_PATHMUSTEXIST), "scite.exe")

            If @error > 0 Then
                MsgBox($MB_SYSTEMMODAL, "Can't find " & $ProcessStr & " to start it", "Please, set the $Process_Path manually in Config.ini ")
                GoToExit()
            Else
                If StringInStr($Process_Path, "scite.exe") > 0 Then IniWrite(@ScriptDir & "\Config.ini", "Configuration", "Process_Path", $Process_Path)
            EndIf
        EndIf
    Else
        $FindProcess = 1
    EndIf
WEnd
$FindProcess = ""

#Region === Read Setting and Create Items ===

 

Edited by Dan_555

Some of my script sourcecode

Link to comment
Share on other sites

@Dan_555 very nice

I'm keeping it simpler for now, and this more to get into the skin of the common user, which I can't tell it to modify the registry
I haven't compiled it, I'm running from script, from the red shortcut as I have described  above

however, when an experienced user adopts this, it's my pleasure and I see it as a success

Thank you very much :)

Edited by ioa747

I know that I know nothing

Link to comment
Share on other sites

PutScriptName.png  PutScriptName.au3

Put the ScriptName in Selection

; https://www.autoitscript.com/forum/topic/208404-scite-plusbar/page/2/#comment-1517517
;------------------------------------------------------------------------------
; Title...........: PutScriptName.au3
; Description.....: Put the ScriptName in Selection
;------------------------------------------------------------------------------
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=..\ICO\PutScriptName.ico
#AutoIt3Wrapper_Res_Description=Put the ScriptName in Selection
#AutoIt3Wrapper_Res_Fileversion=0.0.0.1
#AutoIt3Wrapper_Res_ProductName=PutScriptName.au3
#AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#include <WindowsConstants.au3>
#include <SendMessage.au3>

Global $hScite_Editor_hWnd = ControlGetHandle("[CLASS:SciTEWindow]", '', '[CLASS:Scintilla; INSTANCE:1]')
Global $ClipBack

If Not WinExists("[CLASS:SciTEWindow]") Then
    Exit
EndIf

$ClipBack = ClipGet() ; backup clip data

SciTE_PutItInSelection()

ClipPut($ClipBack) ; Restore clip data

;----------------------------------------------------------------------------------------
Func SciTE_PutItInSelection()

    Local $sTxt = SciTE_CurrentFile()

    ClipPut($sTxt)
    _SendMessage($hScite_Editor_hWnd, $WM_PASTE)

EndFunc   ;==>SciTE_PutItInSelection
;--------------------------------------------------------------------------------------------
Func SciTE_CurrentFile($FullPath = 0) ; Return the Current Scite [0=ScriptName; 1=ScriptFullPath]

    WinMenuSelectItem("[CLASS:SciTEWindow]", "", "&File", "Copy Pat&h")

    Local $ScriptName, $ScriptFullPath = ClipGet()

    If $FullPath = 0 Then
        Local $sSplit = StringSplit($ScriptFullPath, "\")
        $ScriptName = $sSplit[$sSplit[0]]
    Else
        $ScriptName = $ScriptFullPath
    EndIf

    Return $ScriptName

EndFunc   ;==>SciTE_CurrentFile
;----------------------------------------------------------------------------------------

I am attaching the icon as well  PutScriptName.ico

Back to first post

 

Edited by ioa747
UpDate to Version 0.0.0.1

I know that I know nothing

Link to comment
Share on other sites

ToolBox.png ToolBox.au3

ToolBox for SciTE PlusBar

I had included it in SciTE_PlusBar_1.0.0.25 as a tool, albeit incomplete.
I changed the management logic, for easier adding and editing commands directly from SciTE.

As a shortcut menu, useful for entering additional commands, without taking up extra space on the PlusBar
 

ToolBox3.png

 

; https://www.autoitscript.com/forum/topic/208404-scite-plusbar/page/2/#comment-1517956
;------------------------------------------------------------------------------
; Title...........: ToolBox.au3
; Description.....: ToolBox for SciTE PlusBar
;------------------------------------------------------------------------------
#NoTrayIcon
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=..\ICO\ToolBox.ico
#AutoIt3Wrapper_Res_Description=ToolBox for SciTE PlusBar
#AutoIt3Wrapper_Res_Fileversion=0.0.0.10
#AutoIt3Wrapper_Res_ProductName=ToolBox.au3
#AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#include <GuiMenu.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
#include <ListBoxConstants.au3>
#include <GuiListBox.au3>
#include <StaticConstants.au3>
#include <ButtonConstants.au3>
;~ #include <Debug.au3>

Global $AutoItHome = StringLeft(@AutoItExe, StringInStr(@AutoItExe, "\", $STR_NOCASESENSEBASIC, -1) - 1)
Global $MyIni = StringTrimRight(@ScriptFullPath, 4) & ".ini"
Global $MyName = StringSplit($MyIni, "\", 1)
$MyName = $MyName[$MyName[0]]
$MyName = StringTrimRight($MyName, 4)

Global $mPos = MouseGetPos()
Global $hGui = GUICreate("Fav_gui", 32, 32, $mPos[0], $mPos[1], $WS_POPUP, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST, $WS_EX_NOACTIVATE))
GUISetBkColor("0x000000")
WinSetTrans($hGui, "", 2)

;Add FileChangeDir to set the workdir to the scriptdir
FileChangeDir(@ScriptDir)

Global $Scite_Hwnd = WinGetHandle("[CLASS:SciTEWindow]")
Global $aBox = BoxLoad()

#Region === ContextMenu ===
Global $hMenu = GUICtrlCreateContextMenu()

Global $Menu_Add = GUICtrlCreateMenuItem("➕  Add To " & $MyName, $hMenu)
Global $Menu_Remove = GUICtrlCreateMenuItem("➖  Remove From " & $MyName, $hMenu)
GUICtrlCreateMenuItem("", $hMenu)     ; separator   -------------------------------------
Global $Menu_Edit = GUICtrlCreateMenuItem("⚙  Edit " & $MyName, $hMenu)
GUICtrlCreateMenuItem("", $hMenu)     ; separator   -------------------------------------

For $i = 1 To $aBox[0][0]
    GUICtrlCreateMenuItem($aBox[$i][0], $hMenu)
Next

GUICtrlCreateMenuItem("", $hMenu)     ; separator   -------------------------------------
Global $Menu_Cancel = GUICtrlCreateMenuItem("Cancel", $hMenu)
#EndRegion === ContextMenu ===
GUISetState(@SW_SHOW)

;HotKeySet("{END}", "DisplayBox")

; Perform a mouse right click
MouseClick("right")

Global $ID, $TmpSciteFile, $NeedSave = False
; Loop until the user exits.
;********************************************************************
While 1

    $ID = GUIGetMsg()
    Switch $ID
        Case $GUI_EVENT_CLOSE
            ExitLoop
        Case $Menu_Add
            $TmpSciteFile = SciTE_CurrentFile()
            If $TmpSciteFile Then AddToBox($TmpSciteFile)
            ExitLoop
        Case $Menu_Remove
            $TmpSciteFile = SciTE_CurrentFile()
            If $TmpSciteFile Then RemoveFromBox($TmpSciteFile)
            ExitLoop
        Case $Menu_Edit
            $TmpSciteFile = SciTE_CurrentFile()
            BoxEdit($TmpSciteFile)
            ExitLoop
        Case $Menu_Cancel
            ExitLoop
        Case 8 To $aBox[0][0] + 9
            ;ShellExecute($aBox[$ID - 8][1])
            RunFromBox($aBox[$ID - 8][1])
            ExitLoop
    EndSwitch

    If Not WinActive($hGui) Then
        ExitLoop
    EndIf

    Sleep(10)

WEnd
;********************************************************************
;~ Sleep(100) ;
ConsoleWrite("$NeedSave=" & $NeedSave & @CRLF)

If $NeedSave = True Then BoxSave()

GoToExit()
;----------------------------------------------------------------------------------------
Func GoToExit() ; exit
    Exit
EndFunc   ;==>GoToExit
;----------------------------------------------------------------------------------------
Func SciTE_CurrentFile($FullPath = 1) ; Return the Current Scite [0=ScriptName; 1=ScriptFullPath]

    Local $ClipBack = ClipGet() ; backup clip data

    WinMenuSelectItem("[CLASS:SciTEWindow]", "", "&File", "Copy Pat&h")

    Local $ScriptName, $ScriptFullPath = ClipGet()
    ConsoleWrite("$ScriptFullPath=" & $ScriptFullPath & @CRLF)

    If Not FileExists($ScriptFullPath) Then
        Return SetError(1, 0, "")
    EndIf

    If $FullPath = 0 Then
        Local $sSplit = StringSplit($ScriptFullPath, "\")
        $ScriptName = $sSplit[$sSplit[0]]
    Else
        $ScriptName = $ScriptFullPath
    EndIf

    ClipPut($ClipBack) ; Restore clip data

    Return $ScriptName

EndFunc   ;==>SciTE_CurrentFile
;----------------------------------------------------------------------------------------
Func BoxLoad() ; Ini Read
    Local $iniFileExists = FileExists($MyIni)
    Local $index = 0
    Local $aArray[1][2]
    $aArray[0][0] = $index
    $aArray[0][1] = "Path"

    ;Checks if FavoriteMenu.ini not exists then make one.
    If Not $iniFileExists Then
        ;Open the file for writing (append to the end of a file) and store the handle to a variable.
        Local $hFileOpen = FileOpen($MyIni, $FO_APPEND)
        If $hFileOpen = -1 Then
            MsgBox($MB_SYSTEMMODAL, "", "An error occurred while writing the " & $MyName & ".ini")
            GoToExit()
        EndIf

        ;Write data to the file using the handle returned by FileOpen.
        FileWrite($hFileOpen, "[Box_1]" & @CRLF)
        FileWrite($hFileOpen, "Name=" & @ScriptName & "  * <-  Test Run 'another ...Box'" & @CRLF)
        FileWrite($hFileOpen, "Path=" & @ScriptFullPath & @CRLF)
        FileWrite($hFileOpen, "[Box_2]" & @CRLF)
        FileWrite($hFileOpen, "Name=" & "StringRegExpGUI.au3" & @CRLF)
        FileWrite($hFileOpen, "Path=" & $AutoItHome & "\Examples\Helpfile\StringRegExpGUI.au3" & @CRLF)
        FileWrite($hFileOpen, "[Box_3]" & @CRLF)
        FileWrite($hFileOpen, "Name=" & "_WinAPI_EnumWindows.au3" & @CRLF)
        FileWrite($hFileOpen, "Path=" & $AutoItHome & "\Examples\Helpfile\_WinAPI_EnumWindows.au3" & @CRLF)

        ;Close the handle returned by FileOpen.
        FileClose($hFileOpen)
        Sleep(100)
    EndIf

    ;Read the INI section names. This will return a 1 dimensional array.
    Local $aSections = IniReadSectionNames($MyIni)
    ;Check if an error occurred.
    If Not @error Then
        ;Enumerate through the array displaying the section names.
        For $i = 1 To $aSections[0]
            ReDim $aArray[UBound($aArray) + 1][2]
            $index += 1
            $aArray[0][0] = $index ; cnt
            $aArray[$index][0] = IniRead($MyIni, $aSections[$i], "Name", "default") ;Name
            $aArray[$index][1] = IniRead($MyIni, $aSections[$i], "Path", "default") ;Path
        Next
    EndIf

    Return $aArray

EndFunc   ;==>BoxLoad
;----------------------------------------------------------------------------------------
Func BoxSave() ; Save or Make new Ini file
    ;Read the INI section names. This will return a 1 dimensional array.
    Local $aSections = IniReadSectionNames($MyIni)
    ;Check if an error occurred.
    If Not @error Then
        ;Enumerate through the array displaying the section names.
        For $i = 1 To $aSections[0]
            ;Delete the sections
            IniDelete($MyIni, $aSections[$i])
        Next
    EndIf

    ;Write to the .ini
    If Not @error Then
        For $i = 1 To $aBox[0][0]
            IniWrite($MyIni, "Box_" & $i, "Name", $aBox[$i][0])
            IniWrite($MyIni, "Box_" & $i, "Path", $aBox[$i][1])
            ;ConsoleWrite($i & ") " & $aBox[$i][0] & @CRLF)
        Next
    EndIf
EndFunc   ;==>BoxSave
;----------------------------------------------------------------------------------------
Func AddToBox($sFilePath) ; Add to Box
    ; Search if $sFilePath exist (looking in col 2)
    Local $iIndex = _ArraySearch($aBox, $sFilePath, 0, 0, 0, 0, 1, 2)

    If $iIndex > 1 Then Return  ; if all redy exist then return
    Local $mName = StringSplit($sFilePath, "\")
    Local $sFill = $mName[$mName[0]] & "|" & $sFilePath

    _ArrayAdd($aBox, $sFill)

    $aBox[0][0] += 1
    $NeedSave = True
EndFunc   ;==>AddToBox
;----------------------------------------------------------------------------------------
Func RemoveFromBox($sFilePath) ; Remove from Box
    ; Search if $sFilePath exist (looking in col 2)
    Local $iIndex = _ArraySearch($aBox, $sFilePath, 0, 0, 0, 0, 1, 2)
    If $iIndex Then
        _ArrayDelete($aBox, $iIndex)
        $aBox[0][0] -= 1
        $NeedSave = True
    EndIf
EndFunc   ;==>RemoveFromBox
;----------------------------------------------------------------------------------------
Func BoxEdit($sCurrentSciteFile) ; Box Edit
    #Region === Create GUI ===
    Local $hGuiEdit = GUICreate("Edit " & $MyName, 550, 420, -1, -1, -1, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST, $WS_EX_ACCEPTFILES))
    Local $idListBox = GUICtrlCreateList("", 5, 0, 540, 330, BitOR($WS_VSCROLL, $WS_BORDER, $LBS_NOTIFY))
    GUICtrlSetFont(-1, 9)
    GUICtrlCreateLabel("Name:", 5, 330, 30, 10)
    GUICtrlSetFont(-1, 8)
    Local $Input_Name = GUICtrlCreateInput("Name", 5, 345, 460, 21)
    GUICtrlSetFont(-1, 9)
    GUICtrlCreateLabel("Path:", 5, 375, 30, 10)
    GUICtrlSetFont(-1, 8)
    Local $Input_Path = GUICtrlCreateInput("Path", 5, 390, 540, 21)
    GUICtrlSetFont(-1, 7)
    GUICtrlSetState($Input_Path, $GUI_DROPACCEPTED)
    Local $Button_Add = GUICtrlCreateButton("Add", 478, 323, 32, 32, $BS_ICON)
    GUICtrlSetImage(-1, "..\ICO\GUI\BTN_ADD.ico") ;  "mmcndmgr.dll", 30503)
    GUICtrlSetTip(-1, "Add Item")
    Local $Button_Remove = GUICtrlCreateButton("Remove", 478, 356, 32, 32, $BS_ICON)
    GUICtrlSetImage(-1, "..\ICO\GUI\BTN_SUB.ico") ;  "mmcndmgr.dll", 30536)
    GUICtrlSetTip(-1, "Remove Item")
    Local $Button_Up = GUICtrlCreateButton("Up", 513, 323, 32, 32, $BS_ICON)
    GUICtrlSetImage(-1, "..\ICO\GUI\BTN_UP2.ico") ; "mmcndmgr.dll", 30554)
    GUICtrlSetTip(-1, "Move UP")
    Local $Button_Down = GUICtrlCreateButton("Down", 513, 356, 32, 32, $BS_ICON)
    GUICtrlSetImage(-1, "..\ICO\GUI\BTN_DOWN2.ico") ; "mmcndmgr.dll", 30545)
    GUICtrlSetTip(-1, "Move DOWN")
    Local $Button_FileDlg = GUICtrlCreateButton("File", 415, 368, 51, 20)
    GUISetState(@SW_SHOWNORMAL)
    #EndRegion === Create GUI ===
    #Region === ContextMenu ===
    Local $hBoxMenu = GUICtrlCreateContextMenu($idListBox)

    Local $Menu_Add = GUICtrlCreateMenuItem("Add Item ", $hBoxMenu)
    Local $Menu_Remove = GUICtrlCreateMenuItem("Remove Item ", $hBoxMenu)
    GUICtrlCreateMenuItem("", $hBoxMenu) ; separator    -------------------------------------
    Local $Menu_Up = GUICtrlCreateMenuItem("Move UP" & @TAB & "Shift ▲", $hBoxMenu)
    Local $Menu_Down = GUICtrlCreateMenuItem("Move DOWN" & @TAB & "Shift ▼", $hBoxMenu)
    GUICtrlCreateMenuItem("", $hBoxMenu) ; separator    -------------------------------------
    Local $Menu_Edit = GUICtrlCreateMenuItem("Edit ", $hBoxMenu)

    Local $GUI_AccelTable[2][2] = [["+{UP}", $Menu_Up], ["+{DOWN}", $Menu_Down]]
    GUISetAccelerators($GUI_AccelTable, $hGuiEdit)
    #EndRegion === ContextMenu ===

    Local $CurPos, $TmpPos, $AddNew, $mName

    ; Add strings
    _GUICtrlListBox_BeginUpdate($idListBox)
    For $i = 1 To $aBox[0][0]
        _GUICtrlListBox_AddString($idListBox, $aBox[$i][0])
    Next
    _GUICtrlListBox_EndUpdate($idListBox)

    ;ConsoleWrite("$aBox[0][0]=" & $aBox[0][0] & @CRLF)

    ; Search if $sCurrentSciteFile exist (looking in col 2)
    Local $iIndex = _ArraySearch($aBox, $sCurrentSciteFile, 0, 0, 0, 0, 1, 2)
    ;ConsoleWrite("$iIndex=" & $iIndex & @CRLF)
    If $iIndex > 0 Then
        _GUICtrlListBox_SetCurSel($idListBox, $iIndex - 1)
    Else
        _GUICtrlListBox_SetCurSel($idListBox, $aBox[0][0] - 1)
    EndIf

    $CurPos = _GUICtrlListBox_GetCurSel($idListBox)
    ;ConsoleWrite("StartPos=" & $CurPos & @CRLF)

    ; Get currently selected item
    GUICtrlSetData($Input_Name, $aBox[_GUICtrlListBox_GetCurSel($idListBox) + 1][0])
    GUICtrlSetData($Input_Path, $aBox[_GUICtrlListBox_GetCurSel($idListBox) + 1][1])
    GUICtrlSetTip($Input_Path, $aBox[$CurPos + 1][1])

    ; Loop until the user exits.
    While 1
        If $CurPos <> $TmpPos Then
            $TmpPos = $CurPos
            ;ConsoleWrite("$CurPos=" & $CurPos & @CRLF)
        EndIf

        $ID = GUIGetMsg()
        Switch $ID
            Case $GUI_EVENT_CLOSE
                ExitLoop
            Case $idListBox
                ;ConsoleWrite("-- $idListBox" & @CRLF)
                ; Get currently selected item
                $CurPos = _GUICtrlListBox_GetCurSel($idListBox)
                GUICtrlSetData($Input_Name, $aBox[$CurPos + 1][0])
                GUICtrlSetData($Input_Path, $aBox[$CurPos + 1][1])
                GUICtrlSetTip($Input_Path, $aBox[$CurPos + 1][1])
                If $AddNew = True Then
                    $AddNew = False
                    GUICtrlSetState($Input_Name, $GUI_FOCUS)
                    GUICtrlSetTip($Input_Path, "Select or Drop file or folder")
                    Send("^a")
                EndIf
            Case $Input_Name
                ;ConsoleWrite("-- $Input_Name" & @CRLF)
                $aBox[$CurPos + 1][0] = GUICtrlRead($Input_Name)
                _GUICtrlListBox_ReplaceString($idListBox, $CurPos, $aBox[$CurPos + 1][0])
                $NeedSave = True
            Case $Input_Path
                ;ConsoleWrite("-- $Input_Path" & @CRLF)
                $aBox[$CurPos + 1][1] = GUICtrlRead($Input_Path)
                $NeedSave = True
            Case $Button_FileDlg
                ;ConsoleWrite("-- $Button_FileDlg" & @CRLF)
                GUISetState(@SW_HIDE, $hGuiEdit)
                Local $sFileOpenDialog = FileOpenDialog("Select to add in " & $MyName, @ScriptDir & "\", "AutoIT (*.au3)", BitOR($FD_FILEMUSTEXIST, $FD_PATHMUSTEXIST))
                If @error Then
                    MsgBox(4096, "Error", "No file was selected.")
                Else
                    GUICtrlSetData($Input_Path, $sFileOpenDialog)
                    GUICtrlSetTip($Input_Path, $sFileOpenDialog)
                    $aBox[$CurPos + 1][1] = $sFileOpenDialog
                    $mName = StringSplit($sFileOpenDialog, "\")
                    GUICtrlSetData($Input_Name, $mName[$mName[0]])
                    $aBox[$CurPos + 1][0] = $mName[$mName[0]]
                    _GUICtrlListBox_ReplaceString($idListBox, $CurPos, $mName[$mName[0]])
                    $NeedSave = True
                EndIf
                GUISetState(@SW_SHOW, $hGuiEdit)
                $NeedSave = True
            Case $Button_Add, $Menu_Add
                ;ConsoleWrite("-- $Button_Add" & @CRLF)
                Local $sFill = "<Name>|<Path>"
                If $CurPos < $aBox[0][0] - 1 Then
                    ; Insert item delimited string - inserted as 1 row - other rows filled with ""
                    _ArrayInsert($aBox, $CurPos + 1, $sFill)
                    _GUICtrlListBox_InsertString($idListBox, "<Name>", $CurPos)
                    _GUICtrlListBox_ClickItem($idListBox, $CurPos, "left")
                Else
                    _ArrayAdd($aBox, $sFill)
                    _GUICtrlListBox_AddString($idListBox, "<Name>")
                    _GUICtrlListBox_ClickItem($idListBox, $CurPos + 1, "left")
                EndIf
                $aBox[0][0] += 1
                $AddNew = True
                $NeedSave = True
            Case $Button_Remove, $Menu_Remove
                ;ConsoleWrite("-- $Button_Remove" & @CRLF)
                _GUICtrlListBox_DeleteString($idListBox, $CurPos)
                _ArrayDelete($aBox, $CurPos + 1)
                $aBox[0][0] -= 1
                If $CurPos = $aBox[0][0] - 1 Then $CurPos -= 1
                If $CurPos > 0 Then
                    _GUICtrlListBox_ClickItem($idListBox, $CurPos - 1, "left")
                Else
                    _GUICtrlListBox_ClickItem($idListBox, 0, "left")
                EndIf
                $NeedSave = True
            Case $Button_Up, $Menu_Up
                ;ConsoleWrite("-- $Button_Up" & @CRLF)
                If $CurPos > 0 Then
                    ;ConsoleWrite("$aBox[" & $CurPos + 1 & "][0]=" & $aBox[$CurPos + 1][0] & @CRLF)
                    _ArraySwap($aBox, $CurPos + 1, $CurPos)
                    _GUICtrlListBox_SwapString($idListBox, $CurPos, $CurPos - 1)
                    $CurPos -= 1
                    _GUICtrlListBox_SetCurSel($idListBox, $CurPos)
                    $NeedSave = True
                EndIf
            Case $Button_Down, $Menu_Down
                ;ConsoleWrite("-- $Button_Down" & @CRLF)
                If $CurPos < $aBox[0][0] - 1 Then
                    ;ConsoleWrite("$aBox[" & $CurPos + 1 & "][0]=" & $aBox[$CurPos + 1][0] & @CRLF)
                    _ArraySwap($aBox, $CurPos + 1, $CurPos + 2)
                    _GUICtrlListBox_SwapString($idListBox, $CurPos, $CurPos + 1)
                    $CurPos += 1
                    _GUICtrlListBox_SetCurSel($idListBox, $CurPos)
                    $NeedSave = True
                EndIf
            Case $GUI_EVENT_DROPPED
                If @GUI_DropId = $Input_Path Then
                    ; SetImage ico file to $ICON_Drop label
                    GUICtrlSetData($Input_Path, @GUI_DragFile)
                    GUICtrlSetTip($Input_Path, @GUI_DragFile)
                    $aBox[$CurPos + 1][1] = @GUI_DragFile
                    $mName = StringSplit(@GUI_DragFile, "\")
                    GUICtrlSetData($Input_Name, $mName[$mName[0]])
                    $aBox[$CurPos + 1][0] = $mName[$mName[0]]
                    _GUICtrlListBox_ReplaceString($idListBox, $CurPos, $mName[$mName[0]])
                    $NeedSave = True
                EndIf

            Case $Menu_Edit
                ShellExecute($aBox[$CurPos + 1][1])
                ExitLoop

        EndSwitch
        Sleep(10)
    WEnd
    GUIDelete()
EndFunc   ;==>BoxEdit
;----------------------------------------------------------------------------------------
Func DisplayBox() ; _DebugArrayDisplay
    _ArrayDisplay($aBox)
EndFunc   ;==>DisplayBox
;----------------------------------------------------------------------------------------
Func RunFromBox($FilePath) ; Run From Box
    ConsoleWrite($FilePath & @CRLF)
    Run('"' & FileGetShortName(@AutoItExe) & '" /AutoIt3ExecuteScript "' & FileGetShortName($FilePath) & '"')
EndFunc   ;==>RunFromBox
;----------------------------------------------------------------------------------------

 

Back to first post

Edited by ioa747
UpDate to Version 0.0.0.10

I know that I know nothing

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...