Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

Organize Includes in SciTE4Autoit3


  • Please log in to reply
75 replies to this topic

#1 Xenobiologist

Xenobiologist

    Xx Code~Mega xX

  • MVPs
  • 4,821 posts

Posted 13 March 2010 - 10:12 PM

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) ..\AutoIt3\SciTE\
2) Open SciteUser.properties
You'll find the file here : @DocumentsDir\USER\
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)\OrganizeIncludes\OI_1.0.0.50.au3" "$(FilePath)"
command.36.*.au3="c:\Programme\Autoit3\autoit3.exe" "$(SciteDefaultHome)\OrganizeIncludes\OI_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:

Attached Files


Edited by Xenobiologist, 11 June 2013 - 09:24 AM.

  • mLipok and jaberwacky like this

Scripts & functions Organize Includes Let Scite organize the include files *new

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








#2 Yoriz

Yoriz

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 356 posts

Posted 13 March 2010 - 10:46 PM

Didn't see this first time around, very usefull thanks alot :mellow:
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.

#3 dantay9

dantay9

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 834 posts

Posted 13 March 2010 - 11:15 PM

I really like the new GUI. Great job! This tool has been very useful to me.
"Failure is not an option -- it comes packaged with Windows" Gecko Web Browser, Yahtzee!, Toolbar Launcher (like RocketDock)Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI Triangle Solver, TCP File Transfer, Valuater's Autoit WrappersOOP In AutoItUsing Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com

#4 Xenobiologist

Xenobiologist

    Xx Code~Mega xX

  • MVPs
  • 4,821 posts

Posted 13 March 2010 - 11:47 PM

Thank you both! :mellow:

Scripts & functions Organize Includes Let Scite organize the include files *new

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


#5 PartyPooper

PartyPooper

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 689 posts

Posted 14 March 2010 - 12:00 AM

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.

#6 Xenobiologist

Xenobiologist

    Xx Code~Mega xX

  • MVPs
  • 4,821 posts

Posted 14 March 2010 - 12:31 AM

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 *new

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


#7 Shafayat

Shafayat

    Polymath

  • Active Members
  • PipPipPipPip
  • 245 posts

Posted 14 March 2010 - 02:47 AM

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]

#8 MvGulik

MvGulik

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 2,795 posts

Posted 14 March 2010 - 03:11 AM

whatever

Edited by MvGulik, 07 February 2011 - 12:16 PM.


#9 storme

storme

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 848 posts

Posted 14 March 2010 - 06:53 AM

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

#10 Xenobiologist

Xenobiologist

    Xx Code~Mega xX

  • MVPs
  • 4,821 posts

Posted 14 March 2010 - 10:35 AM

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 *new

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


#11 storme

storme

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 848 posts

Posted 14 March 2010 - 11:20 AM

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, 14 March 2010 - 11:22 AM.


#12 Jos

Jos

    oh joy ...

  • Developers
  • 22,535 posts

Posted 14 March 2010 - 11:37 AM

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

Visit the SciTE4AutoIt3 Download page for the latest versions                                                                 Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)


#13 MvGulik

MvGulik

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 2,795 posts

Posted 14 March 2010 - 12:01 PM

whatever

Edited by MvGulik, 07 February 2011 - 12:17 PM.


#14 Xenobiologist

Xenobiologist

    Xx Code~Mega xX

  • MVPs
  • 4,821 posts

Posted 14 March 2010 - 04:59 PM

@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 *new

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


#15 PartyPooper

PartyPooper

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 689 posts

Posted 14 March 2010 - 10:25 PM

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

#16 MvGulik

MvGulik

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 2,795 posts

Posted 16 March 2010 - 05:19 AM

whatever

Edited by MvGulik, 07 February 2011 - 12:17 PM.


#17 Xenobiologist

Xenobiologist

    Xx Code~Mega xX

  • MVPs
  • 4,821 posts

Posted 16 March 2010 - 07:17 AM

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, 16 March 2010 - 07:17 AM.

Scripts & functions Organize Includes Let Scite organize the include files *new

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


#18 damian666

damian666

    Polymath

  • Active Members
  • PipPipPipPip
  • 238 posts

Posted 16 March 2010 - 10:15 AM

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.

Attached Files


Edited by damian666, 16 March 2010 - 11:05 AM.

Posted Imageand proud of it!!!

#19 MvGulik

MvGulik

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 2,795 posts

Posted 16 March 2010 - 02:01 PM

whatever

Edited by MvGulik, 07 February 2011 - 12:17 PM.


#20 Xenobiologist

Xenobiologist

    Xx Code~Mega xX

  • MVPs
  • 4,821 posts

Posted 16 March 2010 - 02:17 PM

Hi,

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

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

AutoIt         
#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 *new

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





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users