• Announcements

Sign in to follow this  
Followers 0

Organize Includes in Scite for Autoit

117 posts in this topic

Posted (edited) · Report post

Hi,

Posted Image

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.

Link --> old Thread : http://www.autoitscript.com/forum/index.php?showtopic=45814

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
Added : new Regex to differ e.g $nr_Max and _Max()
Added : ;~ comments detection

and a lot of little things inside.

NEW THREAD AND VERSION!!! NEW VERSION

So long,

Mega Edited by Xenobiologist

Share this post


Link to post
Share on other sites



Posted · Report post

Hi,

what do I have to do to make this script more useable for beginners or experts?

I'd like to do a rewrite if somebody shows up a possibilty how to get this in handy.

Thanks!

So long,

Mega

Share this post


Link to post
Share on other sites

Posted · Report post

Hi,

what do I have to do to make this script more useable for beginners or experts?

I'd like to do a rewrite if somebody shows up a possibilty how to get this in handy.

Thanks!

So long,

Mega


Looks good so far but a couple of times it says I need guibuttons.au3 but it's wrong.

An example is this script.. (You need to comment out lots of Consts )

I also tried it on RazerM's editor which I'm using. Organize includes said that it didn't need array.au3. I commented it out and it ran fine. <_<

With 'food guide.au3' (3700 lines long) it says guicombobox.au3 needed, but that's not true as far as I can tell, and it also says #include <XSkin.au3> is needed but this is already in the script as #include ".\FoodGuide\XSkin.au3".


Present suggestions.
a progresson or something because there is a delay when you start your script running before you see anything.

It would be helpful if when you say that a certain include file is needed you could show where or why it's needed. With the false button one for example, it would help show why it tells you. Also, if it's correct it's good to be show exactly why, and this gives more confidence.

Glad you've kept working on this. I think a lot of people will have scripts with includes which aren't needed, or they won'tl know what they should include when they paste code in from somewhere and it doesn't work.

Share this post


Link to post
Share on other sites

Posted (edited) · Report post

Hi,

thanks for the nice reply.
I tested you stuff.
1) guibuttons.au3 is needed - I couldn't reproduce it.
2) #include ".\FoodGuide\XSkin.au3" - I have to improve checking for includes with a path and includes in includes
3) suggenstions :
a ) Progress - ok should be possible
b ) Show why is needed - can maybe be done by adding a new column. (takes me some time)

So long,

Mega Edited by Xenobiologist

Share this post


Link to post
Share on other sites

Posted · Report post

I modified Organize Includes for the latest include files.
It produces the result shown below.

[attachment=18275:OrganizIncl.png]
I don't know what the yellow lines with a '1' for the include file mean.

The last line is a small bug I think because dllcallback is not included in my script, but I have two lines in my script like this
$AutoMonItText = StringReplace($AutoMonItText,"#include <dllcallback.au3>","#include " & "'" & $AutoItBetaexePath & "\Include\dllcallback.au3'")
$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) · Report post

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 :P )
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]

Global $start_T = TimerInit()
#cs
* Pr Edited by Xenobiologist

Share this post


Link to post
Share on other sites

Posted · Report post

wow. this is great. hope this will be added in the next scite version as default

Share this post


Link to post
Share on other sites

Posted · Report post

Thanks Mega, some good improvements.

But there is still a problem with the script I sent you (AutoMonitDB.au3). OI says that I don't need GuiScrollbars.au3 but I do.

Share this post


Link to post
Share on other sites

Posted (edited) · Report post

Thanks Mega, some good improvements.

But there is still a problem with the script I sent you (AutoMonitDB.au3). OI says that I don't need GuiScrollbars.au3 but I do.


Hi,

it works for me. Do you have GuiScrollbars.au3 in the folder to check for? Is the GuiScrollbars.au3 listed in the include.ini?
GUIScrollbars.au3=_GUIScrollBars_Init;MY_WM_SIZE;MY_WM_HSCROLL;MY_WM_VSCROLL;_GUIScrollBars_Enable;_


GUIScrollBars_Show;_GUIScrollBars_SetPos;_GUIScrollBars_SetRange;_GUIScrollBars_GetRange;_DebugPrint


Besides, there are functionnames in the GuiScrollbars.au3 that might be double in other udfs like MY_WM_SIZE. This might cause some trouble later on.

@icadea: Thanks, but I guess this is never going to happen. :)

So long,

Mega Edited by Xenobiologist

Share this post


Link to post
Share on other sites

Posted · Report post

Why is it telling my I need ProSpeed.au3 when my program has no reason for it what so ever :)

Share this post


Link to post
Share on other sites

Posted · Report post

Why is it telling my I need ProSpeed.au3 when my program has no reason for it what so ever :)


Hi,

which version of Organize Includes did you try? Try the latest and it will output in Scite why the includes are needed.

Like this:

_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

Share this post


Link to post
Share on other sites

Posted · Report post

Ahh good idea. Thanks TheMG! (You will always be that to me)

Share this post


Link to post
Share on other sites

Posted · Report post

_ArrayDisplay from Array.au3 found
_FileCreate from File.au3 found
_GUICtrlEdit_AppendText from GuiEdit.au3 found
_GUICtrlListView_Create from GuiListView.au3 found
_GUICtrlStatusBar_Create from GuiStatusBar.au3 found
Grey from Prospeed.au3 found
GUICreate from GUIConstants.au3 found

Grey? I don't even use it in a function, its in a comment.

Share this post


Link to post
Share on other sites

Posted · Report post

Hi,

can you pm me your testscript with the needed includes please. So I can have a look at it.

Thanks!

So long,

Mega

Share this post


Link to post
Share on other sites

Posted (edited) · Report post

The word grey is in a comment. Lemme see if I can re-create it.

Put this into a new document:
; Grey word is in a comment

Then run the Organise Includes program and it will tell you, you need Prospeed.au3 Edited by JamesB

Share this post


Link to post
Share on other sites

Posted (edited) · Report post

Hi,

ah okay. Thanks for feedback!!!

I fixed the pattern.

So long,

Mega Edited by Xenobiologist

Share this post


Link to post
Share on other sites

Posted · Report post

Much better! Works well! Awesome work yet again! Thanks!

Share this post


Link to post
Share on other sites

Posted (edited) · Report post

Hi,

it works for me. Do you have GuiScrollbars.au3 in the folder to check for? Is the GuiScrollbars.au3 listed in the include.ini?
GUIScrollbars.au3=_GUIScrollBars_Init;MY_WM_SIZE;MY_WM_HSCROLL;MY_WM_VSCROLL;_GUIScrollBars_Enable;_




GUIScrollBars_Show;_GUIScrollBars_SetPos;_GUIScrollBars_SetRange;_GUIScrollBars_GetRange;_DebugPrint



I have GuiScrollbars in the foder with my script, but I also have a copy in my Includes folder.

In the ini file I get this
GUIScrollbars.au3=_InitScrollDimensions;MY_WM_CREATE;MY_WM_SIZE;MY_WM_VSCROLL;MY_WM_HSCROLL;_EnableS


crollBar;_ShowScrollBar;_SetScrollPos;_SetScrollRange;_GetScrollRange;_DebugPrint

I don't think there can be other places where there is MY_WM_SIZE or I would get errors when I ran the script.
If I rename MY_WM_SIZE to XMY_WM_SIZE in my script and in the GuiScrollBar.au3 file I still get told the file isn't needed.

ANy ideas? Edited by martin

Share this post


Link to post
Share on other sites

Posted · Report post

I have GuiScrollbars in the foder with my script, but I also have a copy in my Includes folder.

In the ini file I get this
GUIScrollbars.au3=_InitScrollDimensions;MY_WM_CREATE;MY_WM_SIZE;MY_WM_VSCROLL;MY_WM_HSCROLL;_EnableS



crollBar;_ShowScrollBar;_SetScrollPos;_SetScrollRange;_GetScrollRange;_DebugPrint

I don't think there can be other places where there is MY_WM_SIZE or I would get errors when I ran the script.
If I rename MY_WM_SIZE to XMY_WM_SIZE in my script and in the GuiScrollBar.au3 file I still get told the file isn't needed.

ANy ideas?


HI,

yes I got an idea and I think it is also the solution. :P

Your two GuiScrollBar.au3 files are different. Look at the found funcs.

Wrong (I think old version)
GUIScrollbars.au3=_InitScrollDimensions;MY_WM_CREATE;MY_WM_SIZE;MY_WM_VSCROLL;MY_WM_HSCROLL;_EnableS

crollBar;_ShowScrollBar;_SetScrollPos;_SetScrollRange;_GetScrollRange;_DebugPrint
Right version (The file you gave me)
GUIScrollbars.au3=_GUIScrollBars_Init;MY_WM_SIZE;MY_WM_HSCROLL;MY_WM_VSCROLL;_GUIScrollBars_Enable;_

GUIScrollBars_Show;_GUIScrollBars_SetPos;_GUIScrollBars_SetRange;_GUIScrollBars_GetRange;_DebugPrint



You are using _GUIScrollBars_Init which is only in one of your GuiScrollBar.au3 files.

The other point MY_WM_SIZE to XMY_WM_SIZE

You do not need to rename the func. What I meant was that e.g. Gary adds to his udfs often the func _DebugPrint. When there are many different udfs in your include folder which OI investigates and all of them contain the func _DebugPrint then this is listed in includes.ini. If you now use the func _DebugPrint then OI would think you need all the includes files which contain this function. Clear??? :)

So long,

Mega

Share this post


Link to post
Share on other sites

Posted · Report post

HI,

yes I got an idea and I think it is also the solution. :P

Your two GuiScrollBar.au3 files are different. Look at the found funcs.

Wrong (I think old version)
GUIScrollbars.au3=_InitScrollDimensions;MY_WM_CREATE;MY_WM_SIZE;MY_WM_VSCROLL;MY_WM_HSCROLL;_EnableS


crollBar;_ShowScrollBar;_SetScrollPos;_SetScrollRange;_GetScrollRange;_DebugPrint
Right version (The file you gave me)
GUIScrollbars.au3=_GUIScrollBars_Init;MY_WM_SIZE;MY_WM_HSCROLL;MY_WM_VSCROLL;_GUIScrollBars_Enable;_


GUIScrollBars_Show;_GUIScrollBars_SetPos;_GUIScrollBars_SetRange;_GUIScrollBars_GetRange;_DebugPrint




You are using _GUIScrollBars_Init which is only in one of your GuiScrollBar.au3 files.

The other point MY_WM_SIZE to XMY_WM_SIZE

You do not need to rename the func. What I meant was that e.g. Gary adds to his udfs often the func _DebugPrint. When there are many different udfs in your include folder which OI investigates and all of them contain the func _DebugPrint then this is listed in includes.ini. If you now use the func _DebugPrint then OI would think you need all the includes files which contain this function. Clear??? :)

So long,

Mega


I don't think you are quite right.
The GuiScrollbars I sent you is the one I use and it is in my script directory. In my script I have
#include "GUIScrollBars.au3"
so I expect that the one in my script directory will be used, but it looks like OI is looking at the one in my includes folder.
Actaully it is the one used or my script wouldn't work. OI looks at the include file (the wrong one in this case) and says none of the functions in this include file are used in the script so the include file is not needed.

I understand what you are saying about MY_WM_SIZE. I only renamed it as a temporary test to see if it made any difference to the OI result, because that way there would only be one file where the function would be found, i.e. in the guiscrollbars.au3 in the script dir. But OI still said it wasn't needed even though there was a function referred to which only occurs in that file.
Is it because OI misses references to functions in GuiRegisterMsg? There are 2 of these in my script-
GUIRegisterMsg($WM_VSCROLL, "MY_WM_VSCROLL");< is OI missing these functions??
GUIRegisterMsg($WM_HSCROLL, "MY_WM_HSCROLL")

Share this post


Link to post
Share on other sites

Posted · Report post

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) · Report post

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) · Report post

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>
#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 Edited by Xenobiologist

Share this post


Link to post
Share on other sites

Posted · Report post

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>
#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) · Report post

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

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  
Followers 0