Jump to content
Sign in to follow this  
Simpel

SciTE command - look for au3abbreviations

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 = 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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Dan_555
      Hi, 
      i'v just uploaded my latest project: Simple Snippet Manager to the Downloads. area :

       

       The intended usage is to select a Snippet, and to copy it's contents into your favorite Editor.
          The Copy/Paste process happens over the (windows)Clipboard. 
          The previous clipboard content is not restored.
          There is a time limit of 60 seconds, in which the pasting of the text is allowed (starting when the App window gets inactive).  
          The Hotkey is reenabled, when the main Window is activated.
          
          This is a File/Folder based manager. 
          The App is configured to hold 4000 files and 400 folders with searching depth of 5 sub-folders.
          
          The root folder is freely selectable, but it  should be a Folder with writing permission.
          Please install the App in a folder with Writing permission, too. 
          This App only uses an .ini file to save it's configuration, which has to be in the same folder as the App.
          
      First configuration:
      1. Open the config Window.
      2. Enter the Language name, create or seek a root folder, enter an extension.
      3. Click on Set button.
      4. Click on the Exit button.
      The Language configuration is done, adding files or folders are needed:
       1. Select the language from the dropbox list, and click on Get Lang button.
      2a. Right Click on the root folder, chose New folder to add categories.
      2b. or chose New/Edit file to open the builtin text editor
       3. Paste or Write a snippet-code, enter a filename and save it.
       
       (Repeat the 3. as needed)
       
      Usage:
      Select a language, then click on Get Lang button.
      Choose a file with the left mouse button.
      Check if the code was loaded in the Textarea at the bottom.
      Switch to your Sourcecode editor, and press the Hotkey (default= Ctrl/Strg b) to copy and paste the text.
      There is a time limit of 60 seconds, after the main window gets inactive, in which the copy&pasting is allowed.
      Changelog:
      V1.02        (24.06.2020)
                  Addition: Undocumented ini setting: StartLoadLastUsedLanguage
                            Setting this to 1 (default value) will now reload the Last used language at start.
                            Last used language counts for the Language, selected with [Get Lang] button. The [Config] button will delete the last used language.
                            LastUsedLanguageNr, LastUsedLanguageName ini settings are used internaly for the above function.
                   Added version string to the main Window title.
      V1.01        (23.06.2020)
                  Bugfix    : Starting the App without the ini file now sets the correct starting Hotkey (Ctrl b)
                  Addition: Clipboard is saved, before pasting, and restored after pasting. (May work with text data only. p.s. untested!)
    • By Dan_555
      Simple Snippet Manager (AutoIt v3.3.14.5)
       The intended usage is to select a Snippet, and to copy it's contents into your favorite Editor.
          The Copy/Paste process happens over the (windows)Clipboard. 
          The previous clipboard content is not restored.
          There is a time limit of 60 seconds, in which the pasting of the text is allowed (starting when the App window gets inactive).  
          The Hotkey is reenabled, when the main Window is activated.
          
          This is a File/Folder based manager. 
          The App is configured to hold 4000 files and 400 folders with searching depth of 5 sub-folders.
          
          The root folder is freely selectable, but it  should be a Folder with writing permission.
          Please install the App in a folder with Writing permission, too. 
          This App only uses an .ini file to save it's configuration, which has to be in the same folder as the App.
          
      First configuration:
      1. Open the config Window.
      2. Enter the Language name, create or seek a root folder, enter an extension.
      3. Click on Set button.
      4. Click on the Exit button.
      The Language configuration is done, adding files or folders are needed:
       1. Select the language from the dropbox list, and click on Get Lang button.
      2a. Right Click on the root folder, chose New folder to add categories.
      2b. or chose New/Edit file to open the builtin text editor
       3. Paste or Write a snippet-code, enter a filename and save it.
       
       (Repeat the 3. as needed)
       
      Usage:
      Select a language, then click on Get Lang button.
      Choose a file with the left mouse button.
      Check if the code was loaded in the Textarea at the bottom.
      Switch to your sourcecode editor, and press the Hotkey (default= Ctrl/Strg b) to copy and paste the text.
      There is a timelimit of 60 seconds, after the main window gets inactive, in which the copy&pasting is allowed.
       
      The Download includes:
      32 + 64bit exe, sourcecode, icon, read me text and 2 Instructional Helpfiles in Html and PDF format.
    • By Bhooshan
      I need to mute an ongoing call on Microsoft teams without activating the window. Teams allows us to mute using shortcut key Ctrl+Shift+m but only when the window is active.
      # Used set option as ongoing call can be with any person which leads to change in Title Name.
      AutoItSetOption ( "WinTitleMatchMode", 2 ) 
      # I am not clear with the control ID which will be good to use here and also the key combination of ^M       
      ControlSend ( "Microsoft Teams", "", "[CLASS:Intermediate D3D Window; INSTANCE:1]", "{ctrl down}")
       
      Can anyone help...!!! 
       

    • By Sayed
      Hi there, 
      I'm new in AutoIt forms and using AutoIt to automate desktop application (able to automate the application normally but facing issue when I've to re-run the application twice within the same script...so need help in this please)
      here is the steps then followed by the issue in a brief : 
      1- run application . 
      2- do some actions (click menus,activate windows,set texts..)
      3- close the application. 
      4- run the application again & access the same controls.
      5- open the same windows again (like step 2)
      6- perform some validations (by getting texts from some text boxes)
      7- close the application again (and repeat 1-7 for 15 times in average )
      The issue 
      * all controls are accessible in the first run and actions done successfully on controls (for steps 1-3) BUT from the second run of the application from step-4 it's able to set focus only the main application window.
      Note: only unique properties used to while mapping the controls. 
      Error that appear in the console :
      UIAWrappers.au3" (1673) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.: $x = Int($t[1] + ($t[3] / 2)) $x = Int($t[1] + (^ ERROR  
      Simple spy code  of one of the controls that has this strange issue(menubar&view menu Item): 
      ;~ *** Standard code maintainable *** #include "UIAWrappers.au3" AutoItSetOption("MustDeclareVars", 1) _UIA_setVar("oP1","Title:=XXX;controltype:=UIA_WindowControlTypeId;class:=WindowsForms10.Window.8.app") ;main app form xxx _UIA_setVar("oP2","Title:=menuStrip1;controltype:=UIA_MenuBarControlTypeId;class:=WindowsForms10.Window.8.app") ;menuStrip1 ;~ $oUIElement=_UIA_getObjectByFindAll("View.mainwindow", "title:=View;ControlType:=UIA_MenuItemControlTypeId", $treescope_subtree) _UIA_setVar("oUIElement","Title:=View;controltype:=UIA_MenuItemControlTypeId;class:=") ;ControlType:=UIA_MenuItemControlTypeId;classname:=") ;~ Actions split away from logical/technical definition above can come from configfiles ;~_UIA_Action("oP1","highlight") _UIA_Action("oP1","setfocus") ;~_UIA_Action("oP2","highlight") _UIA_Action("oP2","setfocus") _UIA_action("oUIElement","highlight") ;~_UIA_action("oUIElement","click")  
       
    • By Fenzik
      Hello All!
      i suggest to set default encoding in Scite4 for Autoit 3 to UTF 8 with Bom encoding, format recommended also in Autoit Help.
      In last editor version, when i open new script, for example Czech characters (č, ř, ž) aren't correct.
      So when i change Encoding to UTF 8 with Bom from Default Code page property state, everithing seems to be OK.
      Thank you and sorry for potentialy duplicated content.
      Fenzik
×
×
  • Create New...