Jump to content

I don't want AutoIt to Include unnecessary functions when #Include is used


 Share

Recommended Posts

Hey,

I've noticed that my script get relatively very big just when I add one extra function that requires an additional #Include. So, is there such a tool in here that would scan my script and then filter out the Globals and the constant included so that only the ones really needed remains?

I'm asking this because; first of all I want my script to be smaller in size (even if it was just for 100 KB, it worth it to my needs). Only if it would make it less in size, that is. And secondly, I believe that it would decrease the amount of false alarms that appears in AV's scans. Yeah, I've got a feeling that it's related to this matter somehow.

So, any ideas? :D

[quote]#include <AutoIt.au3> [indent]$Nothing = Impossible[/quote] [/indent]

Link to comment
Share on other sites

  • Moderators

Derak,

If you are using the full SciTE package (and if not, why not?) then add these lines to the beginning of your script:

#AutoIt3Wrapper_Run_Obfuscator=y
#Obfuscator_Parameters=/SO

Then Jos' little marvel will strip out all unused functions and constants from your code.

Of course, remember that your script is a pretty small part of the .exe - the majority is the AutoIt stub. However, as a major grocery chain here says: "Every little helps!".

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Derak,

If you are using the full SciTE package (and if not, why not?) then add these lines to the beginning of your script:

#AutoIt3Wrapper_Run_Obfuscator=y
 #Obfuscator_Parameters=/SO

Then Jos' little marvel will strip out all unused functions and constants from your code.

Of course, remember that your script is a pretty small part of the .exe - the majority is the AutoIt stub. However, as a major grocery chain here says: "Every little helps!".

M23

I do use the full SciTE package all the time. Also, I always use this one

#AutoIt3Wrapper_Run_Obfuscator=y

But never heard of the other till now actually.

And it's doing the trick pretty well! ^^

After adding #Obfuscator_Parameters=/SO, my .exe got smaller by 130 KB :o

Thanks for you great help, Melba23. ^^

Do you know any extra methods that will get it even smaller in size? :D

For some technical reasons, I need my exe to be less than 250 KB and now it has reached 258 KB (almost there xD)

So, could there be extra things that I can still do to decrease the size even more?

Edited by Derak

[quote]#include <AutoIt.au3> [indent]$Nothing = Impossible[/quote] [/indent]

Link to comment
Share on other sites

  • Developers

I do use the full SciTE package all the time. Also, I always use this one

#AutoIt3Wrapper_Run_Obfuscator=y

But never heard of the other till now actually.

And it's doing the trick pretty well! ^^

After adding #Obfuscator_Parameters=/SO, my .exe got smaller by 130 KB :D

Actually just running Obfuscator will increase the size as this Obfuscates the source which makes the source bigger.

The /SO (/StripOnly) option isn't really related to the Obfuscation process but it rather simple to implement as all the lexing for Variables and Functions was already in the program. Just felt the challenge of stripping out all unused Global variables and (Included) Funcs a nice challenge.

So, could there be extra things that I can still do to decrease the size even more?

Not really... only older versions will lead to a smaller footprint.

The previous mentioned compression works only on included files by FileInstall().

Jos

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

Not doing any changes, I'm still at 258 KB.

Anyway, thanx for replying, KaFu. ^^

Actually just running Obfuscator will increase the size as this Obfuscates the source which makes the source bigger.

I've thought like that a while ago, and tried to compile without Obfuscating.

The result were surprisingly negative!

The exe gets bigger by about 10 KB when it's not Obfuscated. :D

The /SO (/StripOnly) option isn't really related to the Obfuscation process but it rather simple to implement as all the lexing for Variables and Functions was already in the program. Just felt the challenge of stripping out all unused Global variables and (Included) Funcs a nice challenge.

I've to admit, this /SO is the best thing I've learned today.

I was really annoyed by the fact that I have unused funcs included along with my script. >.<

You've done a perfect job with the /SO! :o

Not really... only older versions will lead to a smaller footprint.

The previous mentioned compression works only on included files by FileInstall().

Jos

Too bad, then. :D

Well, thanx for your time and help, Jos. ^^

[quote]#include <AutoIt.au3> [indent]$Nothing = Impossible[/quote] [/indent]

Link to comment
Share on other sites

Hi,

one thing you can do is ...

writing a little script which renames all your variables like this

1 = $1

2 = $2

and so on. This way, you can strip some bytes :D

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

  • Developers

I've thought like that a while ago, and tried to compile without Obfuscating.

The result were surprisingly negative!

The exe gets bigger by about 10 KB when it's not Obfuscated. :o

Ahh, you that person that is the exception and does a lot of inline commenting the source? :D

That could be the reason it becomes smaller as the whitespace and Comments are stripped. The Variable and Function names become longer in general and the obfuscated literal strings & number could become longer as well.

The /so does make a substantial difference as it will strip out up to 90%+ of the actual source size.

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

Hi,

one thing you can do is ...

writing a little script which renames all your variables like this

1 = $1

2 = $2

and so on. This way, you can strip some bytes :(

Mega

Sounds interesting to me :D

I will try it right away!

I kinda like making string split scripts. :P

I will reply back with the results as soon as I get them.

Ahh, you that person that is the exception and does a lot of inline commenting the source? :D

That could be the reason it becomes smaller as the whitespace and Comments are stripped. The Variable and Function names become longer in general and the obfuscated literal strings & number could become longer as well.

The /so does make a substantial difference as it will strip out up to 90%+ of the actual source size.

Well, yeah.

I do include some comments, but space out a lot for the sake of organizing, you know. :o

And thanx for explaining the end result of obfuscating.

Edited by Derak

[quote]#include <AutoIt.au3> [indent]$Nothing = Impossible[/quote] [/indent]

Link to comment
Share on other sites

Sorry for double posting but I promised to post the results ^^

I've done some interesting tries as well: (all of them with \SO and obfuscator=y)

Xenobiologist's method: 253 KB (with obfuscator=n)

Using a different icon: 236 KB (By coincidence, the icon is taking some size!)

Target is archived here! (Less than 50 KB)

:D

The first icon I was using: 26.0 KB!

the second icon I'm using now: 4.73 KB xD

Compiling an empty script: 234 KB

Wow, 234 KB is way too big for an empty script. ^^

I've heard that I would get way smaller than that using other programming languages like C++.

As far as I can remember from my friend who codes in C++.

[quote]#include <AutoIt.au3> [indent]$Nothing = Impossible[/quote] [/indent]

Link to comment
Share on other sites

Compiling an empty script: 234 KB

Wow, 234 KB is way too big for an empty script. ^^

I've heard that I would get way smaller than that using other programming languages like C++.

As far as I can remember from my friend who codes in C++.

'Compiling' as far as AutoIT is concerned is simply putting the script in one file along with the script interpreter. So basically, most of the code you are seeing is the AutoIT script interpreter.

C++ on the other hand is *not* an interpreted language, so it does compile into machine code, which doesn't require anything else to interpret it. HOWEVER, C++ does have libraries that are linked to it depending on the functions or framework you use, so those are included in the final size as well.

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