# Organize Includes in SciTE4Autoit3

## Recommended Posts

Hello everybody,

many languages like Java have got a little helper tool in their IDE, which cares for the right import/include statements.
The helper tool adds the necessary lines for including the needed libraries(or UDFs).
This script organizes the includes for AutoIt and it can be added to SciTE4Autoit3 very easily.

Getting started?
1) Extract the zip here (ProgramsDIR) ..AutoIt3SciTE
2) Open SciteUser.properties
You'll find the file here : @DocumentsDirUSER
or via SciTE menu --> [ Options --> Open User Option File ]

# 36 OrganizeIncludes
#command.36.*.au3="$(autoit3dir)\beta\autoit3.exe" "$(SciteDefaultHome)\OrganizeIncludes\OI_1.0.0.50.au3" "$(FilePath)" command.36.*.au3="$(SciteDefaultHome)\..\autoit3.exe" "$(SciteDefaultHome)\OrganizeIncludes\OI_1.0.0.50.au3" "$(FilePath)"
command.name.36.*.au3=OrganizeIncludes
command.save.before.36.*.au3=1
command.is.filter.36.*.au3=1
command.shortcut.36.*.au3=Ctrl+Shift+Alt+I

If the Autoit3 exe is not found then replace this variable $(autoit3dir) by the correct path. command.36.*.au3="$(autoit3dir)autoit3.exe" "$(SciteDefaultHome)OrganizeIncludesOI_1.0.0.50.au3" "$(FilePath)"
command.36.*.au3="c:ProgrammeAutoit3autoit3.exe" "$(SciteDefaultHome)OrganizeIncludesOI_1.0.0.50.au3" "$(FilePath)"

3) DONE

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.
There is also a helpfile in the zip-file which shows all settings.

Thanks for every comment/idea!

Mega

OrganizeIncludes.zip

Edited by Xenobiologist

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

##### Share on other sites

Didn't see this first time around, very usefull thanks alot

GDIPlusDispose - A modified version of GDIPlus that auto disposes of its own objects before shutdown of the Dll using the same function Syntax as the original.EzMySql UDF - Use MySql Databases with autoit with syntax similar to SQLite UDF.

##### Share on other sites

I really like the new GUI. Great job! This tool has been very useful to me.

[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

##### Share on other sites

Thank you both!

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

##### Share on other sites

Mega, you should get this included as a tool for the standard SciTE4AutoIt3 distribution. It's certainly more useful (to me anyway) than AU3Record, MacroGenerator, CodeWizard, or Koda.

##### Share on other sites

Mega, you should get this included as a tool for the standard SciTE4AutoIt3 distribution. It's certainly more useful (to me anyway) than AU3Record, MacroGenerator, CodeWizard, or Koda.

Thanks for that comment. Let's see what other people say. I guess, when there are some more people using and liking this script, then Jos will also have a look too.

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

##### Share on other sites

Ofcourse it should go into the official distribution. This is great! I have always been using the old version. I'm happy to see a timely upgrade.

[Not using this account any more. Using "iShafayet" instead]

##### Share on other sites
whatever Edited by MvGulik

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...

##### Share on other sites

I've been using this since I started with AutoIT it's revived a LOT of old code that I would have given up on without it. BIG thanks for the update.

One little problem though (isn't there always).

I use "Kips'" TCP.au3 library for one of the programs I am working. It just happened to be the one I tried your code on and OI told me to remove TCP.AU3.

The OI is telling me the sample code doesn't need to include TCP.AU3, of course it does.

http://www.autoitscript.com/forum/index.php?showtopic=74325

Thanks again for the great utility!

John Morrison

AKA

Storm-E

Some of my small contributions to AutoIt Browse for Folder Dialog - Automation SysTreeView32 | FileHippo Download and/or retrieve program information John Morrison aka Storm-E

##### Share on other sites

Bummer, I have a lot of include commands inside a other included file, instead of in the main/root source file.

But. Do I read your TODO's correct that this might be supported in a future version?

PS: When I try to use a build executable instead of the au3 file. The GUI is not showing in my case. (normal au3 case works fine)

Using exe like this:

- au3.properties: command.37.$(au3)="<myPath>\AutoIt3\SciTE\OrganizeIncludes\OrganizeIncludes.exe" "$(FilePath)"

---

Forgot: Win.Xp.Pro.Sp3.x86.?

OI lists all needed includes. If you included a file which internally includes a few others till now, this has no effect on OI. I decided to list all needed includes instead of checking the dependencies. From my point of view, this is better and leads to no problems, cause if you compile your script, you can use Obfuscator from Jos to strip all unneeded lines.

>>> But, I'll have a look whether I can find a good logic to add the option to check includes in includes.

Yes, when you compile OI it doesn't show a GUI. It is in line 385 : If Not @Compiled Then GUISetState(@SW_SHOW)

This is because, using the script as an executable should be used from the commandline. This way, you can use it even without SciTE!

I've been using this since I started with AutoIT it's revived a LOT of old code that I would have given up on without it. BIG thanks for the update.

One little problem though (isn't there always).

I use "Kips'" TCP.au3 library for one of the programs I am working. It just happened to be the one I tried your code on and OI told me to remove TCP.AU3.

The OI is telling me the sample code doesn't need to include TCP.AU3, of course it does.

http://www.autoitscript.com/forum/index.php?showtopic=74325

Thanks again for the great utility!

John Morrison

AKA

Storm-E

Thanks too!

If you are using a function from that UDF, then OI will show you. BUT, you need to tell Oi where to look for that UDF.

Or put the UDF into the ScriptDir an check the ScriptDir in the OI GUI

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

##### Share on other sites

Thanks too!

If you are using a function from that UDF, then OI will show you. BUT, you need to tell Oi where to look for that UDF.

Or put the UDF into the ScriptDir an check the ScriptDir in the OI GUI

Mega

Sorry I ASS-u-ME-d that it read the Include commands and read the UDF's from there.

I ticked the "read udfs from script folder" and it didn't even click then...sigh

Thanks and keep up the great work.

Edited by storme

Some of my small contributions to AutoIt Browse for Folder Dialog - Automation SysTreeView32 | FileHippo Download and/or retrieve program information John Morrison aka Storm-E

##### Share on other sites

.... then Jos will also have a look too.

I seem to remember we already had a background discussion on this last year?

AutoIt3Wrapper currently does something similar for just the Constants include files when you add the directive:

#AutoIt3Wrapper_Add_Constants=                  ;Add the needed standard constant include files. Will only run one time.

I would have no issue adding this Script to the standard tools but believe it would also be nice if we could run it with a directive "each time"/"one time" when you Press Run or Compile. We also need to consider how much time is added running this tool.

I had a quick look at the source of your script and it looks like most of the components for this are in place.

At first glance: things that would be required are support for these parameters on the commandline to be able to run it in batch from AutoIt3Wrapper:

• /AutoIt3dir
• /Beta or /Prod

Jos

Live for the present,
Dream of the future,
Learn from the past.

##### Share on other sites
whatever Edited by MvGulik

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...

##### Share on other sites

@storme

Does that mean, it doesn't work for you? If so, can you send me your constellation, that I can test it myself. Thanks!

@Jos

Thanks, I will add the commandline options soon.

Although, I think, there is no need for an automated start cia Wrapper.

Checking the includes is FMPOV a task which can be done manually by CTRL+ALT+SHIFT+I when needed.

But let's see what the people say.

Besides, there also some other features which I need to add for the next version.(see ToDo list in Source code)

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

##### Share on other sites

+1 on the automated start via Wrapper as it would save me time tracking down which includes I've forgotten or which includes I no longer need when compiling my scripts after making minor changes. While AU3Check always lets me know I've left an include out, it doesn't tell me what the include is, nor will it tell me that I no longer need an include (which is very useful in reducing the size of my compiled scripts). I know I could run OI manually every time but I'm so damn lazy

P.S. used it yesterday on several scripts I thought were OK (and finished) and it's already proven valuable in reducing the size of my compiled scripts. Mega.

##### Share on other sites
whatever Edited by MvGulik

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...

##### Share on other sites

PS: Xenobiologist are you deliberately stripping the input source code of linebreaks?

(I though I got a better & faster alternative RegExp for _getDeclaredIncludes(), but because of the unexpected missing linebreaks it back fired on me the moment I put in in your code for final testing. )

I'm using two variables to handle the source code. One which holds the original code and one which is stripped by every unneeded stuff like emtpy lines, comments and so on. The stripped code is used to get all the stuff done like getting used functions, used variables, declared includes ...

That is why the source in that function looks the way it looks. (it is just to make the script faster!)

Edited by Xenobiologist

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

##### Share on other sites

nice one man, i always use this ^^

i had a older version floating around, which came with a installer, so i made some adjustments to it, so it works with your version too, thought i would

post it so maybe others can use it too.

its in the attachment.

Damian666

*edited for spelling >.<

*edit2 - btw, you need to put the whole folder next to the script, it looks for it in that folder, and i forgot to add the scite useroptions file xD , just put that in your folder.

Installer.au3

SciTEUser.rar

Edited by damian666

and proud of it!!!

##### Share on other sites
whatever Edited by MvGulik

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...

##### Share on other sites

Hi,

how do you get that result? There is no problem on my side.

#include <ComboConstants.au3>
;~ #include <Date.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>

#include <GuiButton.au3>
#include <GUIConstantsEx.au3>
#include <GuiImageList.au3>

#include <GuiButton.au3> ;...
#include <GUIConstantsEx.au3> ;...
#include <GuiImageList.au3> ;...

#include <GuiButton.au3>;...
#include <GUIConstantsEx.au3>;...
#include <GuiImageList.au3>;...
;~ #include "c:\Autoit\ForumTests\Monitor\2nd_Monitor.au3"
GUICreate("My GUI combo") ; will create a dialog box that when displayed is centered
Global $cmb_item = GUICtrlCreateCombo("", 10, 10, 90, 120,$CBS_DROPDOWNLIST); create first item
GUICtrlSetData(-1, "Autoit|SciTE|OrganizeIncludes", "Autoit"); add other item snd set a new default
Global $label = GUICtrlCreateLabel(_NowDate(), 150, 10, 90, 20,$SS_SUNKEN)
GUISetState()

; Run the GUI until the dialog is closed
Local $msg While 1$msg = GUIGetMsg()
Select
Case $msg =$GUI_EVENT_CLOSE
ExitLoop
Case $msg =$cmb_item
GUICtrlSetData($label, GUICtrlRead($cmb_item))
EndSelect
WEnd

;~ _toggleMonitor()

;~ _TCP_Server_Stop()

#include <ComboConstants.au3>
#include <Date.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
;~ #include <Date.au3>

;~ #include "c:\Autoit\ForumTests\Monitor\2nd_Monitor.au3"
GUICreate("My GUI combo") ; will create a dialog box that when displayed is centered
Global $cmb_item = GUICtrlCreateCombo("", 10, 10, 90, 120,$CBS_DROPDOWNLIST); create first item
GUICtrlSetData(-1, "Autoit|SciTE|OrganizeIncludes", "Autoit"); add other item snd set a new default
Global $label = GUICtrlCreateLabel(_NowDate(), 150, 10, 90, 20,$SS_SUNKEN)
GUISetState()

; Run the GUI until the dialog is closed
Local $msg While 1$msg = GUIGetMsg()
Select
Case $msg =$GUI_EVENT_CLOSE
ExitLoop
Case $msg =$cmb_item
GUICtrlSetData($label, GUICtrlRead($cmb_item))
EndSelect
WEnd

;~ _toggleMonitor()

;~ _TCP_Server_Stop()

which seems to be correct.

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

## Create an account

Register a new account

×

• Wiki

• Back

• #### Beta

• Git
• FAQ
• Our Picks
×
• Create New...