Jump to content

Organize Includes in SciTE4Autoit3


Xenobiologist
 Share

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 ]

Add these lines to add OrganizeIncludes to the SciTE menu.
 

# 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.

br86-3.jpg

Old version download ~ 3000!!! THANKS!!! Old versions thread

cat_misc.jpg

Thanks for every comment/idea!

Mega :mellow:

OrganizeIncludes.zip

Edited by Xenobiologist

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_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

Link to comment
Share on other sites

Thank you both! :mellow:

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_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

Link to comment
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)

LoginWrapper Secure scripts by adding a query (authentication)

_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

Link to comment
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 ...
 

Link to comment
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

Link to comment
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.

You can add the path to your UDF via SciTE GUI

Posted Image

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)

LoginWrapper Secure scripts by adding a query (authentication)

_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

Link to comment
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.

You can add the path to your UDF via SciTE GUI

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. :mellow:

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
Link to comment
Share on other sites

  • Developers

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

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

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 :(

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
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 ...
 

Link to comment
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) :mellow:

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_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

Link to comment
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 :mellow:

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.

Link to comment
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 ...
 

Link to comment
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)

LoginWrapper Secure scripts by adding a query (authentication)

_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

Link to comment
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!!!
Link to comment
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 ...
 

Link to comment
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()

;~      _TaskBarItemCreate(
; 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()

Leads to

#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()

;~      _TaskBarItemCreate(
; 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)

LoginWrapper Secure scripts by adding a query (authentication)

_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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...