Followers 0

# Organize Includes in Scite for Autoit

## 117 posts in this topic

Posted (edited)

Hi,

this script scans all the funcs in Autoits include files and you can easily add pathes to your udfs.

Starting the script by hitting CTRL+SHIFT+ALT+I in Scite, it shows you what include files you need and which you do not need.

It is a bit tricky to install it manually (see old thread) because of that I created a quick installer to do the configuration for you. (Installer is in the zip file)

You need Autoit v3.2.12.1 and of course SciTE for Autoit.

Thanks! (martin & Tweaky & Zedna and all the others!!!)

Added : Include pathes to your own udfs now have to be defined in the includes.ini and no in code anymore.

[uDF_Include_Pathes]

MyUDFPath1=

MyUDFPath2=

MyUDFPath3=

MyUDFPath4=

Added : OI now detects selfinclude

Changed: Release and beta includes are now readiobuttons

Changed : OI now works with Release version 3.2.12.1 and higher

$AutoMonItText = StringReplace($AutoMonItText,"#include '#x#x#x#xx#BBAutoMonIt script goes here#x#x#x#x#x#'",$temptext) so I think your script is finding the include even though it is enclosed in quotes. Your script seems to ignore include files like this #include "scrollbars.au3" ;I have 2 includes like this or is that connected with the yellow lines? #### Share this post ##### Link to post ##### Share on other sites Posted (edited) HI, thanks again martin for your feedback. I created a new little beta. Includes in an includes file is still a ToDo. Your suggestions: a ) Progress - I implemented a little progress before the GUI shows up. It is just a beta to show that it works. (I'll make it looking a bit nicer later ) b ) Show why is needed - I made an output to the Scite console to show which func was found and so caused the needed include. After having found one func of Autoit include file e.g. _ArrayDisplay from Array.au3 I skip looking for other funcs from Array.au3, cause it is already needed. You can change that for testing by commenting out the Exitloop in line 366. I improved the regex patterns, so that you can test the dllcallback thing again. I also changed the patterns that way that they should look for "bla.au3" or 'bla.au3' includes from now on. I also changed it to the new funcs from Autoit 3.2.10.0 without having the problems with the 1. The problems you had was this --> Link BugForum I removed the GUI stuff for adding include pathes, cause I never really needed it. I just put all my udf includes in one or two folders and add this path to organize includes here ; ************************************************************** ; Add HERE your own pathes for udfs ; ************************************************************** _ArrayAdd($includesPath, $betaInstallPath & '\include\UDF\') ; _ArrayAdd($includesPath, 'C:\downloads\')
;	_ArrayAdd($includesPath, 'C:\downloads\') ; _ArrayAdd($includesPath, 'C:\downloads\')
; **************************************************************

Thanks again!

So long,

Mega

[autoit]#include<Array.au3>

#include<File.au3>

#include<GuiListView.au3>

#include<GuiStatusBar.au3>

#include<GUIConstants.au3>

; ----------------------------------------------------------------------------

;

; AutoIt Version: 3.2.10.0

; Author: Thorsten Meger

;

; Script Function:

; Organize Includes Version 3.1

;

; ----------------------------------------------------------------------------

;Opt("TrayIconDebug", 1)

Opt("WinSearchChildren", 1)

;[includes]

GUIRegisterMsg($WM_HSCROLL, "MY_WM_HSCROLL") #### Share this post ##### Link to post ##### Share on other sites Posted HI, Autoit looks for include files in ScriptDir and in the normal pathes. You can add a path in Scite by pressing CTRL+1. So, it is your job to say OI where it should look for include files. OI is not looking into files in @scriptdir automatically. Standard is looking here: ; NormalVersion Global$InstallPath = RegRead('HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt', 'InstallDir')
Global $InstallVersion = RegRead('HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt', 'Version') ; BetaVersion Global$betaInstallPath = RegRead('HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt', 'betaInstallDir')
Global $betaInstallVersion = RegRead('HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt', 'betaVersion') ; Variables Dim$includesPath[1]
If $InstallPath <> '' Then _ArrayAdd($includesPath, $InstallPath & '\Include\') If$betaInstallPath <> '' Then _ArrayAdd($includesPath,$betaInstallPath & '\Include\')

and I normally add this ( this is where I save all the nice udfs)

_ArrayAdd($includesPath,$betaInstallPath & '\include\UDF\')

The second point you mentioned

GUIRegisterMsg($WM_HSCROLL, "MY_WM_HSCROLL") OI is missing is right. Never thought of that before. Thanks, I'll have a look whether I can catch funcs which are only called this way. So long, Mega #### Share this post ##### Link to post ##### Share on other sites Posted (edited) Autoit looks for include files in ScriptDir and in the normal pathes. You can add a path in Scite by pressing CTRL+1. So, it is your job to say OI where it should look for include files. OI is not looking into files in @scriptdir automatically. Ok. I didn't know about Ctrl 1, so I added the script directory to the include directories. I still get OI telling me that GuiScrollbars is not needed even though I chose "Renew ini". If AutoIt looks in the script directory then I would have liked it if OI did as well without being told. I always thought until now that #include "filename.au3" meant that the file was in the script directory. I tried #include "Q:\razerMEditor\AutoIt Editor\GuiScrollBars.au3";the full path to the file and OI still tells me the file is not needed. I feel that this is not right but I know it might just be my opinion. But whether I like it or not the question is how do I deal with it? So far nothing I have tried works. Perhaps I misunderstood something you already told me. If I rename the old version of GuiScrollBars.aus which is in the Beta Include folder, and paste a copy of the version of GuiScrollBars.au3 that I want to use then OI still says it is not required. It also says that #include <nomamdmemory.au3> correctly include and on the next line says it is not needed. Is it significant that the include quoted in your results always has the file name between triangular brackets (<>) even though the two file nomadmemory and guiscrollbars appear between quotes in my script? I am sure there is something wrong here. If I'm boring you to death with this just tell me; I don't want to annoy you. Edited by martin #### Share this post ##### Link to post ##### Share on other sites Posted (edited) HI, firstly, you definitely do not boring me. Your tests are great and the only way to improve my stuff. Cause you work different. OKay, I try to explain. Autoit looks into the pathes I mentioned above. For me it is : BETA C:\Programme\AutoIt3\beta\Include Stable C:\Programme\AutoIt3\Include and if you write in your code something like : #include<GUIConstants.au3> or #include"GUIConstants.au3" Autoit looks for the include in @scriptDir first! All OI does is : Scanning all au3 files in the two pathes mentioned above and getting all funcs from them. After that saving it in includes.ini. If you want OI to look for au3 files in other pathes then you have to add them here : ; ************************************************************** ; Add HERE your own pathes for udfs ; ************************************************************** _ArrayAdd($includesPath, $betaInstallPath & '\include\UDF\') ; _ArrayAdd($includesPath, 'C:\downloads\')
;	_ArrayAdd($includesPath, 'C:\downloads\') ; _ArrayAdd($includesPath, 'C:\downloads\')
; **************************************************************

directly in OI!

OI doesn't look for files in the ScriptDir of the file you check. That is the difference to Autoit!

So, all you have to do for your AutoMonItorDB script is the following:

Store all includes you want to scan by OI in one folder and put the path to this folder in the source code of OI. Like this _ArrayAdd($includesPath,$betaInstallPath & '\include\UDF\')

Then open AutoMonItorDB in Scite , Start OI and have a look at the ini. Your udfs should be there if not push renew ini. From now on OI can check your source code with the all funcs in include.ini.

The '"< '"> do not matter if you use the latest version I posted in this thread.

Besides, your script works for me.

It shows this : all green correct includes

#include<GuiComboBox.au3>

#include<GuiListView.au3>

#include<Misc.au3>

#include<GUIConstants.au3>

#include<GUIScrollbars.au3>

because of this (this is in Scite output)

_GUICtrlComboBox_FindString from GuiComboBox.au3 found

_GUICtrlListView_DeleteAllItems from GuiListView.au3 found

_IsPressed from Misc.au3 found

GUICreate from GUIConstants.au3 found

_GUIScrollBars_Init from GUIScrollbars.au3 found

So long,

Mega

Edited by Xenobiologist

##### Share on other sites

Posted

HI,

firstly, you definitely do not boring me. Your tests are great and the only way to improve my stuff.

Cause you work different.

OKay, I try to explain. Autoit looks into the pathes I mentioned above.

For me it is : BETA

C:\Programme\AutoIt3\beta\Include

Stable

C:\Programme\AutoIt3\Include

and if you write in your code something like : #include<GUIConstants.au3> or #include"GUIConstants.au3"

Autoit looks for the include in @scriptDir first!

All OI does is :

Scanning all au3 files in the two pathes mentioned above and getting all funcs from them. After that saving it in includes.ini. If you want OI to look for au3 files in other pathes then you have to add them here :

; **************************************************************
; **************************************************************
_ArrayAdd($includesPath,$betaInstallPath & '\include\UDF\')
;	_ArrayAdd($includesPath, 'C:\downloads\') ; _ArrayAdd($includesPath, 'C:\downloads\')
;	_ArrayAdd($includesPath, 'C:\downloads\') ; ************************************************************** directly in OI! OI doesn't look for files in the ScriptDir of the file you check. That is the difference to Autoit! So, all you have to do for your AutoMonItorDB script is the following: Store all includes you want to scan by OI in one folder and put the path to this folder in the source code of OI. Like this _ArrayAdd($includesPath, $betaInstallPath & '\include\UDF\') Then open AutoMonItorDB in Scite , Start OI and have a look at the ini. Your udfs should be there if not push renew ini. From now on OI can check your source code with the all funcs in include.ini. The '"< '"> do not matter if you use the latest version I posted in this thread. Besides, your script works for me. It shows this : all green correct includes #include<GuiComboBox.au3> #include<GuiListView.au3> #include<Misc.au3> #include<GUIConstants.au3> #include<GUIScrollbars.au3> #include<NomadMemory.au3> because of this (this is in Scite output) _GUICtrlComboBox_FindString from GuiComboBox.au3 found _GUICtrlListView_DeleteAllItems from GuiListView.au3 found _IsPressed from Misc.au3 found GUICreate from GUIConstants.au3 found _GUIScrollBars_Init from GUIScrollbars.au3 found _MemoryOpen from NomadMemory.au3 found So long, Mega Ok, if I restrict to the standard include folders and make sure the udfs I want to use are in them then it works ok. I think some of my problems were caused by me. Sorry for the fuss. The one thing (who am I kidding) that I have a problem with is that OI tells me that I need includes that I don't. So I think there needs to be some logic like "if a function is found in a udf that is included in the script then ignore other udfs which have this function." #### Share this post ##### Link to post ##### Share on other sites Posted (edited) Hi, I'm glad that you got it working. I added the GUIRegisterMsg stuff and made a better Progressbar. The one thing (who am I kidding) that I have a problem with is that OI tells me that I need includes that I don't. So I think there needs to be some logic like "if a function is found in a udf that is included in the script then ignore other udfs which have this function." That's what I meant. You ' ll get trouble when there are the same functionnames in different udfs. I'll think about adding a logic, but I guess it would be better to put those funcs in one extra include file. Here is the latest beta: [autoit]#include<Array.au3> #include<File.au3> #include<GuiListView.au3> #include<String.au3> #include<GuiStatusBar.au3> #include<GUIConstants.au3> ; ---------------------------------------------------------------------------- ; ; AutoIt Version: 3.2.10.0 ; Author: Thorsten Meger ; ; Script Function: ; Organize Includes Version 3.2 ; ; ---------------------------------------------------------------------------- ;Opt("TrayIconDebug", 1) Opt("WinSearchChildren", 1) ;[includes] Global$start_T = TimerInit()

#cs

* Pr

Edited by Xenobiologist