Derak Posted April 14, 2009 Share Posted April 14, 2009 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? Parsix 1 [quote]#include <AutoIt.au3> [indent]$Nothing = Impossible[/quote] [/indent] Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 14, 2009 Moderators Share Posted April 14, 2009 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 Parsix 1 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Derak Posted April 14, 2009 Author Share Posted April 14, 2009 (edited) 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 Thanks for you great help, Melba23. ^^ Do you know any extra methods that will get it even smaller in size? 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 April 14, 2009 by Derak [quote]#include <AutoIt.au3> [indent]$Nothing = Impossible[/quote] [/indent] Link to comment Share on other sites More sharing options...
KaFu Posted April 14, 2009 Share Posted April 14, 2009 #AutoIt3Wrapper_Compression=4 OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Developers Jos Posted April 14, 2009 Developers Share Posted April 14, 2009 (edited) I do use the full SciTE package all the time. Also, I always use this one#AutoIt3Wrapper_Run_Obfuscator=yBut 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 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 April 14, 2009 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 More sharing options...
Derak Posted April 14, 2009 Author Share Posted April 14, 2009 #AutoIt3Wrapper_Compression=4 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. 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! 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. Well, thanx for your time and help, Jos. ^^ [quote]#include <AutoIt.au3> [indent]$Nothing = Impossible[/quote] [/indent] Link to comment Share on other sites More sharing options...
Xenobiologist Posted April 14, 2009 Share Posted April 14, 2009 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 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 More sharing options...
Developers Jos Posted April 14, 2009 Developers Share Posted April 14, 2009 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. Ahh, you that person that is the exception and does a lot of inline commenting the source? 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 More sharing options...
Derak Posted April 14, 2009 Author Share Posted April 14, 2009 (edited) Hi,one thing you can do is ...writing a little script which renames all your variables like this1 = $12 = $2and so on. This way, you can strip some bytes MegaSounds interesting to me I will try it right away!I kinda like making string split scripts. 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? 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. And thanx for explaining the end result of obfuscating. Edited April 14, 2009 by Derak [quote]#include <AutoIt.au3> [indent]$Nothing = Impossible[/quote] [/indent] Link to comment Share on other sites More sharing options...
Derak Posted April 14, 2009 Author Share Posted April 14, 2009 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) 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 KBWow, 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 More sharing options...
Ascend4nt Posted April 14, 2009 Share Posted April 14, 2009 Compiling an empty script: 234 KBWow, 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. My contributions: Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFs | Process CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen) | Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery Wrappers/Modifications of others' contributions: _DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity) UDF's added support/programming to: _ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne) (All personal code/wrappers centrally located at Ascend4nt's AutoIT Code) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now