Jump to content

SciTE command - look for au3abbreviations


Simpel
 Share

Recommended Posts

Hi.

I like to use au3 abbreviations. 'mb2' is often used. But I don't remember them very long. So I wanted to have a little tool looking for it.

This tool is embedded as a command inside SciTE.

First the tool itself:

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Res_Comment=Looks for an au3-abbreviation of a word in Clipboard or $CmdLine.
#AutoIt3Wrapper_Res_Description=Looks for an au3-abbreviation of a word in Clipboard or $CmdLine.
#AutoIt3Wrapper_Res_Fileversion=1.0.0.0
#AutoIt3Wrapper_Res_LegalCopyright=Simpel
#AutoIt3Wrapper_Res_Language=1031
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <File.au3>
 
Global $Ini = @ScriptDir & "\au3abbrev.ini"
Global $au3abbrev =  "PUT IN HERE THE PATH TO\au3abbrev.properties" ; mine is at …\AutoIt3\SciTE\au3abbrev.properties
Global $aGetEntries
Global $sSearch, $sOutput
 
FileCopy($au3abbrev, $Ini, 1) ; make an ini from the properties file
_FileWriteToLine($Ini, 1, "[Dictionary]") ; inserting '[Dictionary]' at first line, to make ini searchable
 
#Region - Look for the right searchstring
If StringLeft($CmdLineRaw, 13) = "/ErrorStdOut " Then ; if not compiled but run with F5 to test
    $sSearch = ClipGet()
ElseIf $CmdLineRaw <> "" Then
    $sSearch = $CmdLineRaw
ElseIf ClipGet() <> "" Then
    $sSearch = ClipGet()
Else
    MsgBox(0, 'Fehler', "Kein Wort zum Suchen gefunden.") ; error
    Exit
EndIf
#EndRegion
 
_GetDefinition()
$sSearch = _Clean($sSearch)
$sOutput = _Search($sSearch)
MsgBox(0, 'au3abbrev.properties', "Ergebnisse für '" & $sSearch & "':" & @CRLF & @CRLF & $sOutput)
Exit
 
#Region - Functions
Func _GetDefinition()
    If FileExists($Ini) Then
        $aGetEntries = IniReadSection($Ini, "Dictionary")
        If @error Then
            MsgBox(0, 'Fehler', "Keine Sektion [Dictionary] gefunden.") ; if inserting of "[Dictionary]" failed
            Exit
        EndIf
    EndIf
EndFunc
 
Func _Search($sInput)
    Local $iCounter = 1
    Local $sfOutput
    For $i = 1 To $aGetEntries[0][0]
        If StringInStr($aGetEntries[$i][1], $sInput) Then ; something is found
            $sfOutput = $sfOutput & _Clean($aGetEntries[$i][0]) & @TAB & _Clean($aGetEntries[$i][1]) & @CRLF & @CRLF
            $iCounter = $iCounter + 1
        EndIf
    Next
    If $sfOutput = "" Then
        $sfOutput = "KEINE ÜBEREINSTIMMUNG" ; no matches found
    EndIf
    Return $sfOutput
EndFunc
 
Func _Clean($sData)
    $sData = StringReplace($sData, "|", "") ; erases "|" because it causes the array to jump to the next entry
    $sData = StringReplace($sData, '"', "") ; erases '"' because it sometimes causes the array to jump to the next entry
    Return $sData
EndFunc
#EndRegion

And now the part at SciTEUser:

# 41 LookAU3Abbrev
command.41.*="H:\_Conrad lokal\Downloads\AutoIt3\_COX\AU3-Abkuerzung.exe" "$(CurrentSelection)"
command.name.41.*=Look Abbrev
command.shortcut.41.*=Ctrl+Shift+Alt+A
command.save.before.41.$(au3)=2

So I mark a regular AutoIt command inside SciTE (with double clicking) and press Ctrl+Shift+Alt+A. I will get a messagebox as answer what abbreviations will contain my sended command. But be careful, not all of these listed abbreviations will expand with space while coding. Abbreviations you want to use have the be declared inside the au3abbrev.keyword.properties(?)

Any suggestions?

Regards, Conrad

Edited by Simpel
SciTE4AutoIt = 3.7.3.0   AutoIt = 3.3.14.2   AutoItX64 = 0   OS = Win_10   Build = 19044   OSArch = X64   Language = 0407/german
H:\...\AutoIt3\SciTE     H:\...\AutoIt3      H:\...\AutoIt3\Include     (H:\ = Network Drive)

   88x31.png  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind.

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