Simpel

SciTE command - look for au3abbreviations

1 post in this topic

#1 ·  Posted (edited)

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

SciTE = 3.6.2.0/full   AutoIt = 3.3.14.2   AutoItX64 = 0   OS = Win7Pro SP1   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.

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

  • Similar Content

    • BlazerV60
      By BlazerV60
      Hello all,
      I've written the code below which launches chrome in incognito mode and then proceeds to go to the autoit website.
      From my understanding, the Run() command is also supposed to output the PID number related to the application that got launched from the Run command.
      However when I run the below lines, it outputs a PID number that is different from the newly launched chrome browser's PID number, does anyone know why and possibly explain how I could retrieve the accurate PID number associated with the newly launched browser?
      Global $iPid = Run(@ComSpec & ' /c start chrome.exe https://www.autoitscript.com/forum/ -incognito' ,"", "") msgbox(0,"",$iPid) Thank you,
      Brian
    • tremolux66
      By tremolux66
      I use a monospace font for editing AutoIt scripts in SciTE (currently, CourierNew 9pt). Regardless of what font size I set in the configuration, when I start SciTE to resume editing the script text is one size smaller than I specified. When I type Ctrl+<numpad-slash> the text changes to the desired size. The same is true of the output pane, and I have to reset the size for both areas every time I start SciTE.
      IIRC, I've made few other changes to the configuration (e.g., changed the search highlight color and disabled Tidy), so this behavior seems odd. About SciTE says it's version 3.6.0 (Aug. 4, 2015).
      Any idea how to fix this?
    • user4157124
      By user4157124
      As they're opinion-based to some degree; how are AutoIt's best practices decided and do suggestions get considered?
      Some suggestions :
      For...To...Step...Next -loop variable-naming like $iN ($i1, $i2, etc.) : conforms to recommended naming convention, identifies level (albeit inverted to ExitLoop and ContinueLoop's convention) and enables SciTE selection-highlighting (requires minimum of 3 characters). Minimize logic in global scope, separate data & settings from logic, use of vertical space, project organization (folder structure, resource- and include file management). Example (loop variable-naming, minimizing logic in global scope and separation of settings from logic) :
      #include <Array.au3> Global Enum $RANDOM_RETURNFLOAT, _ $RANDOM_RETURNINTEGER Global Enum $EXITCODE_NONE Global Const $g_sChar0 = '-' Global Const $g_sChar1 = '+' Global Const $g_iAmountX = 10 Global Const $g_iAmountY = $g_iAmountX Main() Func Main() Local $aArray[$g_iAmountY][$g_iAmountX] For $i1 = 0 To $g_iAmountY - 1 For $i2 = 0 To $g_iAmountX - 1 $aArray[$i1][$i2] = Random(0, 1, $RANDOM_RETURNINTEGER) ? $g_sChar1 : $g_sChar0 Next Next _ArrayDisplay($aArray) Exit $EXITCODE_NONE EndFunc Example (project organization) :
      + project_folder + bak [backup files] + bin [distributed binaries and dependencies] + inc [non-standard include files] + res [resource files (icons, file+install files, etc.)] + usr [configuration files, databases, etc.] - script.au3 - script.exe Example (use of vertical space) :
      Func _DigitalRoot($iNum) Local $sNum = '' Local $aNum While $iNum > 9 $sNum = String($iNum) $aNum = StringSplit($sNum, '') $iNum = 0 For $i1 = 1 To $aNum[0] $iNum += Int($aNum[$i1]) Next WEnd Return $iNum EndFunc
    • wimhek
      By wimhek
      LS
      Is it possible to open file(s) in scite in read only mode ?
      If so, How ?
       
      Thnx
       
    • Hoth2001
      By Hoth2001
      I installed AutoIt to my computer 3 days ago...and have invested the last 3 days learning how to use it.
      As learned in the tutorials, whenever opening I new file in Scite editor I'd immediatley save the file
      I left the Scite Editor open for the past 3 consecutive days on my laptop
       
      No problem
       
      Today I closed Autoit for the first time, restarted my computer, and opened up the Scite Editor
      Now whenever I try to save a file I am prevented from doing so because I apparently don't have permission!?  
      And whenever I try to run any of the programs I've created over the past 3 days now I keep getting annoying popup notifications before I run them
       
      Problem
       
      To go around the issue, I copied a program originally saved in the AUtoIt folder to another folder (since I was barred from saving it in it's original AutoIt location)
      NOw when I run the code the mouse coordiantes are all off
      and I still get that pesky notification whenever I try to run a program
       
      Big Problem!!!
      Anyone have any clue why I'm going through this BS?
       
      1. I checked my User settings and YES I am the administrator on this cpu
      2. I tried to de-select the "read only" attribute for the AutoIt folder (everytime after doing this successfully the folder immediately and automatically reverts back to "read only")
       
      Any help would be MOST appreciated. I've attached screen shots of the annoying bus I keep getting