Eigene Funktionen in Scite "vorschlagen" lassen

  • Hallo,

    ich weiß leider nicht wie ich es besser beschreiben soll!
    Aber wie kann ich meine eigenen Funktionen in Scite eintragen lassen, damit die angezeigt werden?
    Also wenn ich zum Beispiel GUI eingebe kommt ja eine Liste mit Vorschlägen.

    In diese möchte ich meine eigenen Funktionen eintragen, wenn das geht.

    Desweiten werden die Befehle ja farbig hinterlegt..
    Kann man das auch erreichen?

  • Damit sie hellblau sind musst su die in die au3.keywords.properties eintragen. Damit sie in dieser Liste zum vorschlagen ist musst du die au3.api ändern glaub ich.

  • Zu dem Blau färben hatte ich vor langer Zeit mal was geschrieben:

    Spoiler anzeigen
    [autoit]

    #NoTrayIcon
    #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #AutoIt3Wrapper_Version=beta
    #AutoIt3Wrapper_icon=icon.ico
    #AutoIt3Wrapper_Res_Comment=color your own or someone others function's in your SciTE
    #AutoIt3Wrapper_Res_Description=color your own or someone others function's in your SciTE
    #AutoIt3Wrapper_Res_Fileversion=1.0.0.0
    #AutoIt3Wrapper_Res_LegalCopyright=Copyright © 2008 qon
    #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

    [/autoit] [autoit][/autoit] [autoit]

    #include <GuiConstants.au3>
    #include <file.au3>
    #include <array.au3>
    #include <String.au3>

    [/autoit] [autoit][/autoit] [autoit]

    $EditorPath = _RegRead("HKEY_CURRENT_USER\Software\Funcadder","EditorPath",RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt","InstallDir") & "\SciTE")

    [/autoit] [autoit][/autoit] [autoit]

    $Gui = GuiCreate("Funcadder 1.0.0.0 © qon",500,235)
    $Label = GuiCtrlCreateLabel("This was made to add functions to SciTE properties, so the function is shown bright blue in SciTE." & @CRLF & "It's kept simple. This tool also can automaticly scan whole files and make all black own functions blue.",5,10)

    [/autoit] [autoit][/autoit] [autoit]

    $SingleGroup = GuiCtrlCreateGroup("Single",20,50,390,60)
    $SingleAddInput = GuiCtrlCreateInput("_ExampleFunc",33,73,240,22)
    $SingleAddButton = GuiCtrlCreateButton("Add",290,71,100)

    [/autoit] [autoit][/autoit] [autoit]

    $FileGroup = GuiCtrlCreateGroup("File",20,120,460,60)
    $FileAddInput = GuiCtrlCreateInput("C:\ExampleFile.au3",33,143,240,22)
    $FileAddButton = GuiCtrlCreateButton("Scan and add",283,141,85)
    $FileSelectButton = GuiCtrlCreateButton("Select...",380,141,85)

    [/autoit] [autoit][/autoit] [autoit]

    $EditorLabel = GuiCtrlCreateLabel("SciTE Path",8,203)
    $EditorPathInput = GuiCtrlCreateInput($EditorPath,73,200,300)
    $EditorBrowse = GuiCtrlCreateButton("Browse...",383,200,101,20)

    [/autoit] [autoit][/autoit] [autoit]

    Global $LastBrowse = @DesktopDir

    [/autoit] [autoit][/autoit] [autoit]

    GuiSetBkColor(0x18C3DF,$Gui)

    [/autoit] [autoit][/autoit] [autoit]

    GuiSetState()

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    Switch GuiGetMsg()
    Case $GUI_EVENT_CLOSE
    RegWrite("HKEY_CURRENT_USER\Software\Funcadder","EditorPath","REG_SZ",GuiCtrlRead($EditorPathInput))
    Exit
    ;;;
    Case $EditorBrowse
    $EditorPathSelect = FileSelectFolder("Select SciTE folder","")
    IF Not @error then GuiCtrlSetData($EditorPathInput,$EditorPathSelect)
    ;;;
    Case $FileSelectButton
    $FilePathSelect = FileOpenDialog("Please choose an Autoit source file",$LastBrowse,"Autoit Source (*.au3)")
    If Not @error Then
    GuiCtrlSetData($FileAddInput,$FilePathSelect)
    Dim $szDrive, $szDir, $szFName, $szExt
    $SplitPath = _PathSplit($FilePathSelect, $szDrive, $szDir, $szFName, $szExt)
    IF Not @Error Then $LastBrowse = $SplitPath[1] & $SplitPath[2]
    EndIf
    ;;;
    Case $SingleAddButton
    $PropertyFilePath = GuiCtrlRead($EditorPathInput) & "\Properties\au3.keywords.properties"
    $PropertyFileHandle = FileOpen($PropertyFilePath,0)
    $PropertyFileText = FileRead($PropertyFileHandle)
    If Not @error Then
    IF StringInStr($PropertyFileText,GuiCtrlRead($SingleAddInput) & " ") Then
    Msgbox(48,"Already exists","This function does already exist.")
    FileClose($PropertyFileHandle)
    Else
    $NewText = _InsertFunc(GuiCtrlRead($SingleAddInput),$PropertyFileText)
    IF Not @error Then
    FileClose($PropertyFileHandle)
    FileDelete($PropertyFilePath)
    $PropertyFileHandle = FileOpen($PropertyFilePath,2)
    FileWrite($PropertyFileHandle,$NewText)
    FileClose($PropertyFileHandle)
    Msgbox(64,"Added","The function was added successfully!")
    Else
    GuiCtrlSetData($SingleAddInput,"error while adding.")
    FileClose($PropertyFileHandle)
    EndIf
    EndIf
    Else
    Msgbox(48,"Error","Error opening property file, maybe SciTE path invalid.")
    EndIf
    ;;;
    Case $FileAddButton
    $SourceFilePath = GuiCtrlRead($FileAddInput)
    If Not FileExists($SourceFilePath) or StringRight($SourceFilePath,4) <> ".au3" Then
    Msgbox(48,"Error","File does not exist or invalid file extension.")
    Else
    $SourceFile = FileOpen($SourceFilePath,0)
    $Source = FileRead($SourceFile)
    If @error Then
    Msgbox(48,"Error","Error while reading source file or file is empty.")
    FileClose($SourceFile)
    Else
    $FuncFound = _StringBetween($Source, 'Func ', '(')
    If @error Then
    Msgbox(64,"No founds","No user functions found.")
    FileClose($SourceFile)
    Else
    FileClose($SourceFile)
    $PropertyFilePath = GuiCtrlRead($EditorPathInput) & "\Properties\au3.keywords.properties"
    $PropertyFileHandle = FileOpen($PropertyFilePath,0)
    $PropertyFileText = FileRead($PropertyFileHandle)
    If @error then
    Msgbox(48,"Error","Error while reading property file.")
    FileClose($PropertyFileHandle)
    Else
    $Founds = 0
    For $i = 0 to UBound($FuncFound)-1
    If Not StringInStr($PropertyFileText,$FuncFound[$i] & " ") Then
    $PropertyFileText = _InsertFunc($FuncFound[$i],$PropertyFileText)
    $Founds += 1
    EndIf
    Next
    FileClose($PropertyFileHandle)
    FileDelete($PropertyFilePath)
    $PropertyFileHandle = FileOpen($PropertyFilePath,2)
    FileWrite($PropertyFileHandle,$PropertyFileText)
    FileClose($PropertyFileHandle)
    Msgbox(64,"Added",$Founds & " functions were made blue")
    EndIf
    EndIf
    EndIf
    EndIf
    EndSwitch
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func _InsertFunc($sFuncName,$sFileText)
    $Pos = StringInStr($sFileText,"au3.keywords.udfs=")
    IF @error Then SetError(1,0,0)
    $Start = StringLeft($sFileText, $Pos + 17)
    $End = StringRight($sFileText, StringLen($sFileText) - $Pos - 17)
    Return $Start & StringLower($sFuncName) & " \" & @CRLF & $End
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    ;===============================================================================
    ;
    ; Function Name: _regread()
    ; Description: Reads a registry entry ( with a given standard )
    ; Parameter(s): $iKeyname - The registry key to read
    ; $iValuename - The value to read
    ; $iStandard - The standard that will be returned if registry entry does not exists [optional]
    ; Requirement(s): None
    ; Return Value(s): On Success - Returns the Registry Value, if @error occurres ( can't find key / unknown format ) the standard will be returned.
    ; On Failure - If no standard is set and can't read Key, the @error number from regread will be returned ( Helpfile ).
    ; Author(s): qon
    ;
    ;===============================================================================

    [/autoit] [autoit][/autoit] [autoit]

    func _regread($sKeyname,$sValuename,$vStandard = "")
    Local $vValue
    Local $iError
    $vValue = Regread($sKeyname,$sValuename)
    $iError = @error
    If $iError <> 0 Then
    If $vStandard = "" Then
    Seterror($iError)
    Return ""
    EndIf
    Return $vStandard
    EndIf
    Return $vValue
    EndFunc

    [/autoit] [autoit][/autoit] [autoit][/autoit]

    Kann eben auch ne ganze .au3 Datei mit Funktionen durchgehen und macht sie alle blau.
    Musst SciTE danach neustarten

  • Vielen Dank qon!


    Genau das wollte ich auch Skripten. :D
    Du hast das für mich quasi gemacht.

    Jetzt muss ich mir was neues überlegen.