Jump to content

how to down size program ?


Recommended Posts

I have a GUI and some fuction, I think it's small. But when i compile it, program about 400 KB :|

And i see other program coded by AutoIT, it outgrow mine multiple times but it's about 260KB ! Who can help me compress size of program ?

Edited by squallA
Link to comment
Share on other sites

I have a GUI and some fuction, I think it's small. But when i compile it, program about 400 KB :|

And i see other program coded by AutoIT, it outgrow mine multiple times but it's about 260KB ! Who can help me compress size of program ?

are you adding other files with your script?
Link to comment
Share on other sites

You can set the compression level from Aut2Exe.exe (Menu Compression - Highest).

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

  • Developers

You can set the compression level from Aut2Exe.exe (Menu Compression - Highest).

nah..Only works for FileInstall() ..

LAst version sizes:

When using UPX it should be approx 230Kb

When UPX is switched off it will be approx 440Kb

Edited by JdeB

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

Do the include files add a lot.

I see some that skip some includes and the equivalent constant numbers.

But I tend to collect a lot of the includes at the top of my code, like:

#include <GUIConstants.au3>

#include <IE.au3>

#include <File.au3>

#Include "Misc.au3"

#Include <Process.au3>

#Include <Constants.au3>

#include <INet.au3>

#include <Array.au3>

But I would not expect them to add much at all to the compiled exe, no?

gsb

"Did you ever stop to think? ...and forget to restart!"
Link to comment
Share on other sites

  • Moderators

Do the include files add a lot.

I see some that skip some includes and the equivalent constant numbers.

But I tend to collect a lot of the includes at the top of my code, like:

#include <GUIConstants.au3>

#include <IE.au3>

#include <File.au3>

#Include "Misc.au3"

#Include <Process.au3>

#Include <Constants.au3>

#include <INet.au3>

#include <Array.au3>

But I would not expect them to add much at all to the compiled exe, no?

gsb

If you'd like to get an idea of the size difference before and after...

If you are using 3.2.2.0 then run the below script, if you are using a beta, change the directories of $Au2 and $Exe2

$file = FileOpenDialog('pick', @ScriptDir, 'Au3 (*.au3)')
If @error = -1 Then Exit
$Au2 = '"' & @ProgramFilesDir & '\AutoIt3\Aut2Exe\Aut2Exe.exe"'
$Exe2 =  '"' & @ProgramFilesDir & '\AutoIt3\Extras\Exe2Aut\Exe2Aut.exe"'
$newfile = _CompileDecompile($file, $Au2, $Exe2, 'bbbb')

Dim $sStringMain = FileRead($file), $nSizeMain = FileGetSize($file)
Dim $sStringNew = FileRead($newfile), $nSizeNew = FileGetSize($newfile)
Dim $nMainLines = UBound(StringSplit(StringStripCR($sStringMain), @LF)) - 1
Dim $nNewLines = UBound(StringSplit(StringStripCR($sStringNew), @LF)) - 1

FileDelete($newfile)

MsgBox(64, 'Info', '**** Current File ****' & @CRLF & _
    'Line Count = ' & $nMainLines & @CRLF & _
    'Kb size = ' & Round($nSizeMain / 1024, 2) & @CRLF & @CRLF & _
    '**** After Includes ****' & @CRLF & _
    'Line Count = ' & $nNewLines & @CRLF & _
    'kb size = ' & Round($nSizeNew / 1024, 2))

Func _CompileDecompile($filename, $Au2Exe, $Exe2Aut, $pass = 'asdf')
    RunWait ($Au2Exe & ' /in "' & $filename & '" /out "' & $filename & '.exe" /pass "' & $pass & '"')
    RunWait($Exe2Aut & ' /in "' & $filename & '.exe" /out "' & $filename & '_Output.au3" /pass "' & $pass & '"')
    FileDelete($filename & '.exe')
    Return $filename & '_Output.au3'
EndFunc

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Point well taken!!

Than you again SmOke_N.

**** Current File ****

Line Count = 308

Kb size = 9.66

**** After Includes ****

Line Count = 8458

kb size = 328.22

gsb

"Did you ever stop to think? ...and forget to restart!"
Link to comment
Share on other sites

I wanted to come back to this one.

A new control, and I copied pieces of the include files I needed, so I have no includes in the .au3 file.

The .au3 file is 5k and the .exe is 214k.

Now I do include a 19K .ico file but it looks like close to 200k as a minimum for a .exe file, no?

So I do not think that your measure as above is the last word on the subject; although enlightening.

Thoughts?

gsb

"Did you ever stop to think? ...and forget to restart!"
Link to comment
Share on other sites

  • Moderators

I wanted to come back to this one.

A new control, and I copied pieces of the include files I needed, so I have no includes in the .au3 file.

The .au3 file is 5k and the .exe is 214k.

Now I do include a 19K .ico file but it looks like close to 200k as a minimum for a .exe file, no?

So I do not think that your measure as above is the last word on the subject; although enlightening.

Thoughts?

gsb

You are compiling with UPX if your .exe is that size. To get a real comparison of what you are doing, compile without compression.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Thanks for the hint.

I will try that next.

You are a great resource SmOke_N, ... thank you.

I hope you do not get bored with my posts.

gsb

"Did you ever stop to think? ...and forget to restart!"
Link to comment
Share on other sites

Nope.

I went to the compiler and 'unchecked' UPX which, by default I guess, was checked as you suspected.

Then went an recompiled the script: It went to over 400K.

I am simply not understanding enough about AutoIt yet I think. :whistle:

gsb

"Did you ever stop to think? ...and forget to restart!"
Link to comment
Share on other sites

Then went an recompiled the script: It went to over 400K.

If you compile your script (using UPX) without any files installed, you will see that not the file was inlarging your compiled script, this is the *.bin file do this (from Aut2Exe.exe folder). So this is not mether how many files you install, the minimum size of your program will be something around the 200-220 kb (depends on script size itself and AutoIt version) - therefore, the .ico file is only “take” 19 kb (or even less if you use UPX) from main size of your program (in your case). Edited by MsCreatoR

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

Thank you MsCreatoR.

And if I understand you correctly, my minimum sized compiled script should always be in the 200 - 220 k range and up, depending on my code. Correct?

gsb

"Did you ever stop to think? ...and forget to restart!"
Link to comment
Share on other sites

minimum sized compiled script should always be in the 200 - 220 k range and up, depending on my code. Correct?

Yes, this is correct, but also depending on AutoIt futures versions, because on early versions (3.1.0 i think) it was around 170-180 kb for script :whistle:

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

Just to add a little bit more info on file sizes...

I made a 297-line program which .au3 was 9.07kb in size, and added a 3.49kb readme file, a 2.78kb jpg image, and a 2.18kb icon.

With AutoIt Beta v3.2.1.1 installed over AutoIt v3.1.1.0, I was only able to cut down the file size to 185kb, and I tried all the tricks of using numbers instead of includes and cutting out only the functions I needed, etc.

Hope this helps, if nothing but for general information.

-Cool-

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