vmars Posted August 26, 2009 Share Posted August 26, 2009 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 expandcollapse popup; 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 expandcollapse popup;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 More sharing options...
Moderators Melba23 Posted August 26, 2009 Moderators Share Posted August 26, 2009 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=/SOThis 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 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...
AdmiralAlkex Posted August 26, 2009 Share Posted August 26, 2009 Also don't forget to set compression to max. #AutoIt3Wrapper_Compression=4 .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
vmars Posted August 26, 2009 Author Share Posted August 26, 2009 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 More sharing options...
Developers Jos Posted August 26, 2009 Developers Share Posted August 26, 2009 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..vmWhy 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 More sharing options...
Moderators Melba23 Posted August 26, 2009 Moderators Share Posted August 26, 2009 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 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...
vmars Posted August 27, 2009 Author Share Posted August 27, 2009 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.M23M23;I am not 'trying to shortcut the system', i am trying to understand WhatIs 'AutoIt3Wrapper', 1) why should i use it2) 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 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