Jump to content

my scrawny two pgms = 617kb


vmars
 Share

Recommended Posts

Here are my two scrany pgms FileWriteLog_vm.exe :

FileWriteLog_vm.au3 and FileWriteLog_vm_inc.au3 .

Please, how can i whittle them down? Do i need all those includes?

Thanks..vm

; FileWriteLog_vm.au3
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <C:\Users\thisUser\Documents\AutoIt3\Projects-vm\FileWriteLog-vm-Folder\FileWriteLog_vm_inc.au3>
Opt("GUIOnEventMode", 1)
;Global $vmLogFileName, $vmLogFileAction, $vmLogThisMsg, $file, $LineCnt

$Form1 = GUICreate("Test FileWriteLog_vm.au3", 683, 170, 260, 145)
GUISetBkColor(0x0E2765, $Form1); (0xA0A0A0)
GUICtrlCreateGraphic(11, 38, 664, 66)
GUICtrlSetBkColor(-1, 0xFFD8D8); (-1, 0x3A6EA5)  (-1, 0xFFD8D8)
GuiCtrlSetState(-1,$GUI_DISABLE)  ;(-1,$GUI_DISABLE)
;GUICtrlCreateGroup("", -99, -99, 1, 1) ; Close Group
$Group1 = GUICtrlCreateGroup("", 8, 32, 665, 73)
;
$hButton1 = GUICtrlCreateButton("create", 88, 57, 75, 25, $WS_GROUP)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x800000)
$hButton2 = GUICtrlCreateButton("open", 232, 57, 75, 25, $WS_GROUP)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x800000)
$hButton3 = GUICtrlCreateButton("write", 376, 57, 75, 25, $WS_GROUP)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x800000)
$hButton4 = GUICtrlCreateButton("close", 520, 56, 75, 25, $WS_GROUP)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x800000)
GUICtrlCreateGroup("", -99, -99, 1, 1) ; Close Group

GUISetState(@SW_SHOW)

GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
GUICtrlSetOnEvent($hButton1, "createButton") ; createButton
GUICtrlSetOnEvent($hButton2, "openButton")   ; createButton
GUICtrlSetOnEvent($hButton3, "writeButton")  ; createButton
GUICtrlSetOnEvent($hButton4, "closeButton")  ; createButton
GUISetOnEvent($GUI_EVENT_CLOSE,"closeButton")
 ;WinSetTrans("Example","",127)

;GUISetState(@SW_ENABLE)

While 1
    Sleep(100) ; Very important or you eat CPU cycles
WEnd

Func createButton()
         $vmLogFileName = "DebugLog.txt"
         $vmLogFileAction = "create"
         $vmLogThisMsg = "create"
         FileWriteLog_vmFunc() ;
EndFunc

Func openButton()
         $vmLogFileName = "DebugLog.txt"
         $vmLogFileAction = "open"
         $vmLogThisMsg = "open"
         FileWriteLog_vmFunc()
EndFunc

Func writeButton()
         $LineCnt = $LineCnt +1
         $vmLogFileName = "DebugLog.txt"
         $vmLogFileAction = "write"
         $vmLogThisMsg = ("Log message line " & $LineCnt)
         FileWriteLog_vmFunc()
EndFunc

Func closeButton()
         $vmLogFileName = "DebugLog.txt"
         $vmLogFileAction = "close"
         $vmLogThisMsg = "close"
         FileWriteLog_vmFunc()
EndFunc

Func Form1Close()
    Exit
EndFunc

;FileWriteLog_vm_inc.au3
#include <File.au3>
Global $vmLogFileName, $vmLogFileAction, $vmLogThisMsg, $file, $LineCnt

Func FileWriteLog_vmFunc()

Switch $vmLogFileAction
   Case "create"
        $LineCnt = 0
        If $vmLogFileAction = "create" Then
            If FileExists($vmLogFileName) Then
                FileDelete($vmLogFileName)
               If Not _FileCreate($vmLogFileName) Then
           MsgBox(0, "_FileCreate Didn't work  ",  $vmLogFileName)
                            EndIf
               $vmLogFileAction = "created"
 ;              MsgBox(0,$vmLogFileAction,$vmLogFileName)
    EndIf
EndIf
    Case "open"
        $LineCnt = 0
        $file = FileOpen($vmLogFileName, 1)
        ; Check if file opened for writing OK
        If $file = -1 Then
            $vmLogThisMsg = "openError"
            Exit
        EndIf
        $vmLogFileAction = "opened"
    Case "write"
;         $LineCnt = $LineCnt +1
        FileWrite($file, ($vmLogThisMsg & @CRLF))
        $vmLogFileAction = "written"
;        MsgBox(0, "Writing Line:    ",  $vmLogFileName)
    Case "close"
        FileClose($file)
        $vmLogFileAction = "closed"
        Exit
EndSwitch
EndFunc
Link to comment
Share on other sites

  • Moderators

vmars,

If you are using the full SciTE4AutoIt3 install and compiling using AutoIt3Wrapper, add the following directive at the top of your script before compile:

#Obfuscator_Parameters=/SO

This will strip out all the unused parts of the include files and reduce the size of your script to a minimum.

However, most of the 600kb is the AutoIt stub which interprets your script at runtime, which you cannot reduce. However, if you use upx to compress them (an easy checkbox selection in Autoit3Wrapper), you will get your compiled exes down to about 350kb.

And that is about as far as it goes!

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

vmars,

If you are using the full SciTE4AutoIt3 install and compiling using AutoIt3Wrapper, add the following directive at the top of your script before compile:

#Obfuscator_Parameters=/SO

This will strip out all the unused parts of the include files and reduce the size of your script to a minimum.

However, most of the 600kb is the AutoIt stub which interprets your script at runtime, which you cannot reduce. However, if you use upx to compress them (an easy checkbox selection in Autoit3Wrapper), you will get your compiled exes down to about 350kb.

And that is about as far as it goes!

M23

I found this AutoIt3Wrapper_Gui.au3 --saved it as==> AutoIt3WrapperGui_vm.au3

Which now looks like beelow:

; AutoItWrapperGui_vm.au3
#NoTrayIcon
;#RequireAdmin
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=AutoIt3Wrapper.ico
#AutoIt3Wrapper_UseUpx=n
;~ #AutoIt3Wrapper_UseAnsi=y
#AutoIt3Wrapper_Res_Comment=AutoIt3Wrapper GUI to set the AutoIt3Wrapper directives.
#AutoIt3Wrapper_Res_Description=AutoIt3Wrapper GUI to set the AutoIt3Wrapper directives.
#AutoIt3Wrapper_Res_Fileversion=2.0.0.0
#AutoIt3Wrapper_Res_FileVersion_AutoIncrement=p
#AutoIt3Wrapper_Res_LegalCopyright=Copyright © 2009 Jos van der Zande
://////=__=
://////=__=
://////=__=
://////=__=
#AutoIt3Wrapper_Au3Check_Parameters=-q -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#AutoIt3Wrapper_Run_After=copy "%in%" "..\..\WsciteUpdates\AutoIt3Wrapper"
#AutoIt3Wrapper_Run_After=copy "%out%" "..\..\WsciteUpdates\AutoIt3Wrapper"
#AutoIt3Wrapper_Run_After=copy "%in%" "c:\program files (x86)\autoit3\SciTE\AutoIt3Wrapper"
#AutoIt3Wrapper_Run_After=copy "%out%" "c:\program files (x86)\autoit3\SciTE\AutoIt3Wrapper"
#Tidy_Parameters=/gd /sf
#AutoIt3Wrapper_Run_cvsWrapper=v
#AutoIt3Wrapper_cvsWrapper_Parameters=/comments "%fileversion% \n"
#AutoIt3Wrapper_Run_Obfuscator=y
#AutoIt3Wrapper_Add_Constants=n
#Obfuscator_Parameters=/striponly
#Obfuscator_Parameters=/SO
#AutoIt3Wrapper_Compression=4
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

I must have done something wrong, because size went from 617kb to 602kb?

Should i have a separate AutoIt3Wrapper for non-Gui apps?

Also, what is the PortableAutoIt3 ?

Thanks..vm

Link to comment
Share on other sites

  • Developers

I found this AutoIt3Wrapper_Gui.au3 --saved it as==> AutoIt3WrapperGui_vm.au3

Which now looks like beelow:

I must have done something wrong, because size went from 617kb to 602kb?

Should i have a separate AutoIt3Wrapper for non-Gui apps?

Also, what is the PortableAutoIt3 ?

Thanks..vm

Why would you want to do this?

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

  • Moderators

vmars,

You need to install the full version of SciTE4AutoIt3 from http://www.autoitscript.com/autoit3/scite/downloads.shtml and then compile from within the much improved version of SciTE designed to work with Autoit that this gives you.

So, trying to shortcut the system by renaming files will not do - you need to install the package to get the full benefit. And it is worth it - you get lots of nice tools built-in as well as the AutoitWrapper directives and compression option AdmiralAlkex and I were talking about.

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

vmars,

So, trying to shortcut the system by renaming files will not do - you need to install the package to get the full benefit. And it is worth it - you get lots of nice tools built-in as well as the AutoitWrapper directives and compression option AdmiralAlkex and I were talking about.

M23

M23;

I am not 'trying to shortcut the system', i am trying to understand WhatIs 'AutoIt3Wrapper',

1) why should i use it

2) and how should i use it?

3) What options should i use?

4) If it is beneficial to use it, how can i get it to Insert itself into a New_Untitled_Au3_File?

5) Where can i find an 'AutoIt3Wrapper_Template'.

I see the Files in Folder'C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper', but it doesn't how to UseAutoIt3Wrapper, and when i Search the Help for 'AutoIt3Wrapper', all i get is 'AutoIt and Developer History '.

I think i'll start a new topic for this: How to use AutoIt3Wrapper?

Thanks..vm

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