Sign in to follow this  
Followers 0
BugFix

Abbrev Management in SciTE

5 posts in this topic

#1 ·  Posted (edited)

Hi,

you know that SciTE includes a lot of abbreviations. I've made an management tool for abbrevs. All existing abbrevs will shown in an Listview, left side the abbrev, right side the abbrev code.

What can you do:

- Add own abbrevs

- Edit abbrevs

- Delete abbrevs

- Click on an Item shows an GUI with AutoIt-code of this abbrev

- Insert an new abbrev in the Input. By hitting button 'Add' you got an GUI to copy in or write AutoIt-code for this abbrev. The abbrev will saved by closing GUI.

All your changes will integrated in abbrev-file: "@UserProfileDir & '\abbrev.properties'" and will saved for restore in "@UserProfileDir & '\abbrev.properties.my'".

The keywords will integrated in keyword-file: "..\SciTE\properties\au3.keywords.abbreviations.properties" and will saved for restore in "@UserProfileDir & '\au3.keywords.my'".

If you update or reinstall SciTE all your own abbrevs and changes are lost. Because that, i save all abbrevs and keywords in own files. So you can reset all with menu entry "Restore".

Note: To take effect new or edited abbrevs you need an restart of SciTE.

Edit:

Thanks Jos for the reload function.

Also there was an bug by Edit and Delete, now fixed.

#include-once
#include <Array.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <StaticConstants.au3>
#include <StructureConstants.au3>
#include <WindowsConstants.au3>
#include <File.au3>
#include <GUIListView.au3>
#include <GuiEdit.au3>
Opt("GUIOnEventMode", 1)

Global $ScitePath = RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\SciTE.exe", "")
Global $KeyWordPath = StringReplace($ScitePath, "SciTE.exe", "properties\au3.keywords.abbreviations.properties")
Global $MyKeyWordPath = @UserProfileDir & '\au3.keywords.my'
Global $Abbr_Path = @UserProfileDir & '\abbrev.properties'
Global $MyAbbrevPath = @UserProfileDir & '\abbrev.properties.my'
       If Not FileExists($MyAbbrevPath) Then
           Local $fh = FileOpen($MyAbbrevPath, 1)
           FileWriteLine($fh, '; >> My own abbrevs <<')
           FileClose($fh)
       EndIf
Global $Start_STR = '#; -- Gui Variables --', $start = False, $edit = False
Global $Last_STR = '#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#'
Global $txt, $aTitel[2] = ['Code for new abbrev', 'Code edit']
Global $aLabel[2] = [ _
        'Please insert code for your abbrev. Indentation with <TAB> (inside edit with STRG+TAB).' & @LF & _
        'To set cursor position use pipe: |  . Code will saved by closing window.', _
        'Edit here your code. Indentation with <TAB> (inside edit with STRG+TAB).' & @LF & _
        'To set cursor position use pipe: |  . Code will saved by closing window.']
Global $aAbbrev
_FileReadToArray($Abbr_Path, $aAbbrev)

$Form1 = GUICreate("Abbrev Management  [" & $Abbr_Path & ']', 800, 620, -1, -1)
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
$mnu = GUICtrlCreateMenu('Restore')
$mnu_restore = GUICtrlCreateMenuItem('Restore own Abbrevs', $mnu)
GUICtrlSetOnEvent(-1, '_Restore')
$iSearch = GUICtrlCreateInput('', 15, 10, 90, 20)
$bSearch = GUICtrlCreateButton('Search', 125, 10, 150, 20, $BS_DEFPUSHBUTTON)
GUICtrlSetOnEvent(-1, '_Search')
$bCreate = GUICtrlCreateButton('Add', 295, 10, 150, 20)
GUICtrlSetOnEvent(-1, '_Create')
$bEdit = GUICtrlCreateButton('Edit', 465, 10, 150, 20)
GUICtrlSetOnEvent(-1, '_Edit')
$bDelete = GUICtrlCreateButton('Delete', 635, 10, 150, 20)
GUICtrlSetOnEvent(-1, '_Delete')
$ListView1 = GUICtrlCreateListView("Abbrev|Code", 15, 40, 770, 545, BitOR($LVS_SHOWSELALWAYS, $LVS_SINGLESEL, $WS_HSCROLL, $WS_VSCROLL))
GUICtrlSetOnEvent(-1, "ListView1Click")
GUICtrlSetBkColor(-1, 0xFF9E00)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_LV_ALTERNATE)
GUICtrlSendMsg(-1, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_ONECLICKACTIVATE, $LVS_EX_ONECLICKACTIVATE)
_GUICtrlListView_SetColumnWidth(-1, 0, 90)
_GUICtrlListView_SetColumnWidth(-1, 1, $LVSCW_AUTOSIZE_USEHEADER)

_LV_Fill()

$Form2 = GUICreate('Abbrev - Code', 700, 400, -1, -1)
GUISetOnEvent($GUI_EVENT_CLOSE, "Form2Close")
$Edit1 = GUICtrlCreateEdit('', 10, 10, 680, 380, BitOR($GUI_SS_DEFAULT_EDIT, $ES_READONLY))
GUICtrlSetBkColor(-1, 0x98FB98)

$Form3 = GUICreate('Abbrev - New Code', 700, 400, -1, -1)
GUISetOnEvent($GUI_EVENT_CLOSE, "Form3Close")
$Label1 = GUICtrlCreateLabel('Please insert code for your abbrev. Indentation with <TAB> (inside edit with STRG+TAB).' & @LF & _
        'To set cursor position use pipe: |  . Code will saved by closing window.' _
        , 10, 5, 680, 30, $SS_SUNKEN + $SS_CENTER)
GUICtrlSetBkColor(-1, 0x98FB98)
$Edit2 = GUICtrlCreateEdit('', 10, 40, 680, 350, BitOR($WS_HSCROLL, $WS_VSCROLL, $ES_MULTILINE, $ES_WANTRETURN))
GUICtrlSetBkColor(-1, 0x98FB98)

GUISetState(@SW_SHOW, $Form1)
GUIRegisterMsg($WM_NOTIFY, "MY_WM_COMMAND")

While 1
    Sleep(100)
WEnd

Func Form1Close()
    Exit
EndFunc   ;==>Form1Close

Func Form2Close()
    GUISetState(@SW_HIDE, $Form2)
    GUICtrlSetData($Edit1, '')
EndFunc   ;==>Form2Close

Func Form3Close()
    GUISetState(@SW_HIDE, $Form3)
    If $edit Then
        _WriteEditedAbbrev()
    Else
        _WriteNewAbbrev()
    EndIf
EndFunc   ;==>Form3Close

Func _Search()
    $txt = GUICtrlRead($iSearch)
    If $txt = '' Then Return
    Local $indx = _LV_FindInSubItem($ListView1, $txt, 0)
    If $indx = -1 Then
        MsgBox(0, 'Search Abbrev', 'Abbrev: "' & $txt & '" not exists.')
    Else
        _GUICtrlListView_EnsureVisible($ListView1, $indx)
        _GUICtrlListView_SetItemSelected($ListView1, $indx)
    EndIf
EndFunc   ;==>_Search

Func _Create()
    $txt = GUICtrlRead($iSearch)
    If $txt = '' Then Return MsgBox(16, 'Error', 'No abbrev inserted.')
    Local $indx = _LV_FindInSubItem($ListView1, $txt, 0)
    If $indx > -1 Then Return MsgBox(16, 'Error', 'Abbrev always exists.')
    $edit = False
    WinSetTitle($Form3, '', $aTitel[0])
    GUICtrlSetData($Label1, $aLabel[0])
    GUISetState(@SW_SHOW, $Form3)
EndFunc   ;==>_Create

Func _Edit()
    $txt = GUICtrlRead($iSearch)
    If $txt = '' Then Return MsgBox(16, 'Error', 'No abbrev selected.')
    $edit = True
    WinSetTitle($Form3, '', $aTitel[1])
    GUICtrlSetData($Label1, $aLabel[1])
    GUICtrlSetData($Edit2, _Abbrev2Code(_GUICtrlListView_GetItemText($ListView1, _LV_FindInSubItem($ListView1, $txt, 0), 1)))
    GUISetState(@SW_SHOW, $Form3)
EndFunc   ;==>_Edit

Func _Restore()
    Local $aMyAbbrev, $split_a, $split_f
    _FileReadToArray($MyAbbrevPath, $aMyAbbrev)
    For $i = 2 To UBound($aMyAbbrev) - 1
        $start = False
        For $j = 1 To UBound($aAbbrev) - 1
            If $aAbbrev[$j] = $Start_STR Then $start = True
            If (Not $start) Or (StringLeft($aAbbrev[$j], 1) = '#') Or ($aAbbrev[$j] = '') Then ContinueLoop
            $split_a = _SplitOnce($aAbbrev[$j])
            If @error Then ContinueLoop
            $split_f = _SplitOnce($aMyAbbrev[$i])
            If @error Then ContinueLoop
            If $split_a[0] = $split_f[0] Then
                ConsoleWrite($split_f[0] & @CRLF)
                $aAbbrev[$j] = $split_f[0] & '=' & $split_f[1]
                WinSetTitle($Form1, '', 'Restore Abbrev: ' & $split_f[0])
                $aMyAbbrev[$i] = -1
                ExitLoop
            EndIf
        Next
    Next
    For $i = 2 To UBound($aMyAbbrev) - 1
        If $aMyAbbrev[$i] = -1 Then ContinueLoop
        $split_f = _SplitOnce($aMyAbbrev[$i])
        WinSetTitle($Form1, '', 'Restore Abbrev: ' & $split_f[0])
        Sleep(20)
        ReDim $aAbbrev[UBound($aAbbrev) + 1]
        $aAbbrev[UBound($aAbbrev) - 1] = $aMyAbbrev[$i]
        For $j = UBound($aAbbrev) - 1 To 1 Step -1
            If $aAbbrev[$j] = $Last_STR Then ExitLoop
        Next
        _ArraySwap($aAbbrev[UBound($aAbbrev) - 1], $aAbbrev[$j])
    Next
    FileMove($Abbr_Path, $Abbr_Path & '.BAK', 1)
    _FileWriteFromArray($Abbr_Path, $aAbbrev, 1)
    If FileExists($MyKeyWordPath) Then
        Local $aMyKeyWord
        _FileReadToArray($MyKeyWordPath, $aMyKeyWord)
        For $i = 1 To UBound($aMyKeyWord) - 1
            WinSetTitle($Form1, '', 'Restore Keyword: ' & $aMyKeyWord[$i])
            Sleep(20)
            _KeyWordSet($aMyKeyWord[$i], 1)
        Next
    EndIf
    _FileReadToArray($Abbr_Path, $aAbbrev)
    WinSetTitle($Form1, '', 'Restore')
    MsgBox(64, 'Restore', 'Restore finished.', 1.5)
    WinSetTitle($Form1, '', "Abbrev Management  [" & $Abbr_Path & ']')
    _GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($ListView1))
    _LV_Fill()
EndFunc   ;==>_Restore

Func _LV_FindInSubItem($hWnd, $2Find, $SubIndex)
    Local $out = -1
    For $i = 0 To _GUICtrlListView_GetItemCount($hWnd) - 1
        If _GUICtrlListView_GetItemText($hWnd, $i, $SubIndex) = $2Find Then $out = $i
    Next
    Return $out
EndFunc   ;==>_LV_FindInSubItem

Func ListView1Click()
    Local $indx = _GUICtrlListView_GetHotItem($ListView1)
    GUICtrlSetData($iSearch, _GUICtrlListView_GetItemText($ListView1, $indx, 0))
    GUICtrlSetData($Edit1, _Abbrev2Code(_GUICtrlListView_GetItemText($ListView1, $indx, 1)))
    GUISetState(@SW_SHOW, $Form2)
EndFunc   ;==>ListView1Click

Func _LV_Fill()
    GUISetState(@SW_LOCK, $Form1)
    Local $k = 0
    $start = False
    For $i = 1 To UBound($aAbbrev) - 1
        If $aAbbrev[$i] = $Start_STR Then $start = True
        If (Not $start) Or (StringLeft($aAbbrev[$i], 1) = '#') Or ($aAbbrev[$i] = '') Then ContinueLoop
        $var = _SplitOnce($aAbbrev[$i])
        If @error Then ContinueLoop
        GUICtrlCreateListViewItem('|', $ListView1)
        GUICtrlSetBkColor(-1, 0xFFF278)
        _GUICtrlListView_SetItemText($ListView1, $k, $var[0], 0)
        _GUICtrlListView_SetItemText($ListView1, $k, $var[1], 1)
        $k += 1
    Next
    GUISetState(@SW_UNLOCK, $Form1)
EndFunc   ;==>_LV_Fill

Func _SplitOnce($STRING, $DELIM = '=')
    If Not StringInStr($STRING, $DELIM) Then Return SetError(1, 0, 1)
    Local $out[2]
    Local $len = StringLen($STRING)
    Local $pos = StringInStr($STRING, $DELIM, 1, 1)
    $out[0] = StringLeft($STRING, $pos - 1)
    $out[1] = StringRight($STRING, $len - $pos)
    Return $out
EndFunc   ;==>_SplitOnce

Func _Abbrev2Code($ABBREV)
    Local $out = ''
    $var = StringSplit($ABBREV, '\n', 1)
    For $i = 1 To UBound($var) - 1
        If StringInStr($var[$i], '\t', 1) Then $var[$i] = StringReplace($var[$i], '\t', @TAB)
        If $i = UBound($var) - 1 Then
            $out &= $var[$i]
        Else
            $out &= $var[$i] & @CRLF
        EndIf
    Next
    Return $out
EndFunc   ;==>_Abbrev2Code

Func _Code2Abbrev()
    Local $out = '', $count = _GUICtrlEdit_GetLineCount($Edit2), $line
    If @error Then Return SetError(1)
    For $i = 0 To $count - 1
        $line = _GUICtrlEdit_GetLine($Edit2, $i)
        If StringInStr($line, @TAB, 1) Then $line = StringReplace($line, @TAB, '\t')
        If $i = $count - 1 Then
            $out &= $line
        Else
            $out &= $line & '\n'
        EndIf
    Next
    Return $out
EndFunc   ;==>_Code2Abbrev

Func _WriteNewAbbrev()
    If GUICtrlRead($Edit2) = '' Then Return
    Local $abbr = _Code2Abbrev()
    Local $fh = FileOpen($MyAbbrevPath, 1)
    FileWriteLine($fh, $txt & '=' & $abbr)
    FileClose($fh)
    ReDim $aAbbrev[UBound($aAbbrev) + 1]
    $aAbbrev[UBound($aAbbrev) - 1] = $txt & '=' & $abbr
    For $i = UBound($aAbbrev) - 1 To 1 Step -1
        If $aAbbrev[$i] = $Last_STR Then ExitLoop
    Next
    _ArraySwap($aAbbrev[UBound($aAbbrev) - 1], $aAbbrev[$i])
    FileMove($Abbr_Path, $Abbr_Path & '.BAK', 1)
    _FileWriteFromArray($Abbr_Path, $aAbbrev, 1)
    _KeyWordSet($txt)
    $fh = FileOpen($MyKeyWordPath, 1)
    FileWrite($fh, $txt & @CRLF)
    FileClose($fh)
    _FileReadToArray($Abbr_Path, $aAbbrev)
    _GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($ListView1))
    GUICtrlSetData($Edit2, '')
    $start = False
    $k = 0
    _LV_Fill()
    Local $idx = _LV_FindInSubItem($ListView1, $txt, 0)
    _GUICtrlListView_EnsureVisible($ListView1, $idx)
    _GUICtrlListView_SetItemSelected($ListView1, $idx)
    Reload_Config()
EndFunc   ;==>_WriteNewAbbrev

Func _WriteEditedAbbrev()
    If GUICtrlRead($Edit2) = '' Then Return
    Local $abbr = _Code2Abbrev()
    Local $fh = FileOpen($MyAbbrevPath, 0)
    Local $content = FileRead($fh)
    FileClose($fh)
    If Not StringRegExp($content, '\r\n' & $txt & '=') Then
        $fh = FileOpen($MyAbbrevPath, 1)
        FileWriteLine($fh, $txt & '=' & $abbr)
        FileClose($fh)
    Else
        $fh = FileOpen($MyAbbrevPath, 0)
        Local $line, $row = 2
        While 1
            $line = FileReadLine($fh, $row)
            If @error = -1 Then ExitLoop
            $split_f = _SplitOnce($line)
            If $txt = $split_f[0] Then ExitLoop
            $row += 1
        WEnd
        FileClose($fh)
        _FileWriteToLine($MyAbbrevPath, $row, $txt & '=' & $abbr, 1)
    EndIf
    Local $line = _GetLine() - 1
    Local $idx = _LV_FindInSubItem($ListView1, $txt, 0)
    $aAbbrev[$line] = $txt & '=' & $abbr
    _GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($ListView1))
    GUICtrlSetData($Edit2, '')
    $start = False
    $k = 0
    _LV_Fill()
    _FileWriteToLine($Abbr_Path, $line, $txt & '=' & $abbr, 1)
    _GUICtrlListView_EnsureVisible($ListView1, $idx)
    _GUICtrlListView_SetItemSelected($ListView1, $idx)
    Reload_Config()
EndFunc   ;==>_WriteEditedAbbrev

Func _Delete()
    $txt = GUICtrlRead($iSearch)
    If MsgBox(262180, 'Attention', 'You are sure that ' & @LF & '>> ' & $txt & ' <<' & @LF & ' should delete?') = 7 Then Return
    Local $idx = _GetLine() - 1
    $aAbbrev[$idx] = ''
    _GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($ListView1))
    GUICtrlSetData($iSearch, '')
    $start = False
    $k = 0
    _LV_Fill()
    _FileWriteToLine($Abbr_Path, $idx, '', 1)
    $fh = FileOpen($MyAbbrevPath, 0)
    Local $line, $row = 2
    While 1
        $line = FileReadLine($fh, $row)
        If @error = -1 Then ExitLoop
        $split_f = _SplitOnce($line)
        If @error Then ContinueLoop
        If $txt = $split_f[0] Then ExitLoop
        $row += 1
    WEnd
    FileClose($fh)
    _FileWriteToLine($MyAbbrevPath, $row, '', 1)
    Local $keys = FileRead($KeyWordPath)
    $keys = StringReplace($keys, $txt & ' ', '', 1, 1)
    Local $fh = FileOpen($KeyWordPath, 2)
    FileWrite($fh, $keys)
    FileClose($fh)
    $keys = FileRead($MyKeyWordPath)
    $keys = StringReplace($keys, $txt & @CRLF, '', 1, 1)
    $fh = FileOpen($MyKeyWordPath, 2)
    FileWrite($fh, $keys)
    FileClose($fh)
    Reload_Config()
EndFunc   ;==>_Delete

Func _GetLine()
    Local $var
    For $i = 1 To UBound($aAbbrev) - 1
        $var = _SplitOnce($aAbbrev[$i], '=')
        If @error Then ContinueLoop
        If $var[0] = $txt Then Return $i + 1
    Next
EndFunc   ;==>_GetLine

Func _KeyWordSet($KEYWORD, $CHECK = 0)
    Local $txtZeile, $len
    If $CHECK Then
        Local $fh = FileOpen($KeyWordPath, 0)
        Local $read = FileRead($fh)
        FileClose($fh)
        If StringInStr($read, $KEYWORD & ' ', 1) Then Return
    EndIf
    $zeile = _FileCountLines($KeyWordPath)
    $txtZeile = FileReadLine($KeyWordPath, $zeile)
    $len = StringLen($txtZeile) + 4
    If $len + StringLen($KEYWORD) > 100 Then
        _FileWriteToLine($KeyWordPath, $zeile, $txtZeile & "\" & @CRLF, 1)
        _FileWriteToLine($KeyWordPath, $zeile + 1, @TAB & $KEYWORD & " ", 1)
    Else
        _FileWriteToLine($KeyWordPath, $zeile, $txtZeile & $KEYWORD & " ", 1)
    EndIf
EndFunc   ;==>_KeyWordSet

Func MY_WM_COMMAND($hWnd, $Msg, $wParam, $lParam)
    Switch $wParam
        Case $ListView1
            Local $tagNMHDR = DllStructCreate("int;int;int", $lParam)
            If @error Then Return $GUI_RUNDEFMSG
            If DllStructGetData($tagNMHDR, 3) = $NM_CLICK Then ListView1Click()
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc   ;==>MY_WM_COMMAND

; Thanks to Jos for following functions:
Func Reload_Config()
    ;Send SciTE Director my GUI handle so it will report info back from SciTE
    SendSciTE_Command("reloadproperties:")
EndFunc   ;==>Reload_Config
; Send command to SciTE
Func SendSciTE_Command($sCmd, $Wait_For_Return_Info = 0)
    Local $WM_COPYDATA = 74
    Local $WM_GETTEXT = 0x000D
    Local $WM_GETTEXTLENGTH = 0x000E224
    Local Const $SCI_GETLINE = 2153
    Local $Scite_hwnd = WinGetHandle("DirectorExtension") ; Get SciTE DIrector Handle
    Local $My_Hwnd = GUICreate("AutoIt3-SciTE interface") ; Create GUI to receive SciTE info
    Local $My_Dec_Hwnd = Dec(StringTrimLeft($My_Hwnd, 2)) ; Convert my Gui Handle to decimal
    $sCmd = ":" & $My_Dec_Hwnd & ":" & $sCmd ; Add dec my gui handle to commandline to tell SciTE where to send the return info
    ConsoleWrite('SciTE Command  --> ' & $sCmd & @LF)
    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', $My_Hwnd, _
            'Ptr', DllStructGetPtr($COPYDATA))
    GUIDelete($My_Hwnd)
EndFunc   ;==>SendSciTE_Command

AbbrevManagement.au3

Edited by BugFix
1 person likes this

Best Regards BugFix  

Share this post


Link to post
Share on other sites



You can reload the SciTE config including the abbrevs without restarting SciTE. Just add this code and call Reload_Config() after you saved the file.

I did get an error when testing and editing an test abbrev.

Jos

test.au3 (290) : ==> Subscript used with non-Array variable.:

If Not StringRegExp($content, '\r\n' & $split_a[0] & '=') Then

If Not StringRegExp($content, '\r\n' & $split_a^ ERROR

;
Func Reload_Config()
    ;Send SciTE Director my GUI handle so it will report info back from SciTE
    SendSciTE_Command("reloadproperties:")
EndFunc   ;==>Reload_Config
; Send command to SciTE
Func SendSciTE_Command($sCmd, $Wait_For_Return_Info = 0)
    Local $WM_COPYDATA = 74
    Local $WM_GETTEXT = 0x000D
    Local $WM_GETTEXTLENGTH = 0x000E224
    Local Const $SCI_GETLINE = 2153
    Local $Scite_hwnd = WinGetHandle("DirectorExtension") ; Get SciTE DIrector Handle
    Local $My_Hwnd = GUICreate("AutoIt3-SciTE interface") ; Create GUI to receive SciTE info
    Local $My_Dec_Hwnd = Dec(StringTrimLeft($My_Hwnd, 2)) ; Convert my Gui Handle to decimal
    $sCmd = ":" & $My_Dec_Hwnd & ":" & $sCmd ; Add dec my gui handle to commandline to tell SciTE where to send the return info
    ConsoleWrite('SciTE Command  --> ' & $sCmd & @LF)
    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', $My_Hwnd, _
            'Ptr', DllStructGetPtr($COPYDATA))
    GUIDelete($My_Hwnd)
EndFunc   ;==>SendSciTE_Command

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

You can reload the SciTE config including the abbrevs without restarting SciTE. Just add this code and call Reload_Config() after you saved the file.

I did get an error when testing and editing an test abbrev.

Jos

Many thanks for reload function and testing. Bug is now fixed, i hope that was all. ;)


Best Regards BugFix  

Share this post


Link to post
Share on other sites

Great stuff!!! I have added my own abbreviations to Scite.... manually.

This will come in handy. Thanks for your work and sharing it.

Share this post


Link to post
Share on other sites

Sweet! Thanks for posting your stuff here, BugFix. You have some great scripts but most of the versions I have are Google translated to English from the German forum (and probably a little off). I think this one came out as "Ach-Tung, Shorty!"

Share this post


Link to post
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
Sign in to follow this  
Followers 0