Jump to content

Includes Helper


asdf8
 Share

Recommended Posts

has cut my script files sizes by 2.5x

Unfortunately, this is just an illusion. The main objective of the program - add necessary for the proper execution of the script include files.

To reduce the actual size of script you must use with a key, such as "/striponly".

Link to comment
Share on other sites

Hi,

I think I have found a bug

When I try your tool with the following script the file "scroll.au3" will be not included

#Region    ;************ Includes ************
#Include <WindowsConstants.au3>
#EndRegion ;************ Includes ************
GUIRegisterMsg($WM_SIZE, "WM_SIZE")

scroll.au3

#region    ;************ Includes ************
#include-once
#include <GUIConstantsEx.au3>
#include <GuiScrollBars.au3>
#include <ScrollBarConstants.au3>
#endregion    ;************ Includes ************
Func WM_SIZE($hWnd, $Msg, $wParam, $lParam)
#forceref $Msg, $wParam
Local $index = -1, $yChar, $xChar, $xClientMax, $xClient, $yClient, $ivMax
For $x = 0 To UBound($aSB_WindowInfo) - 1
  If $aSB_WindowInfo[$x][0] = $hWnd Then
   $index = $x
   $xClientMax = $aSB_WindowInfo[$index][1]
   $xChar = $aSB_WindowInfo[$index][2]
   $yChar = $aSB_WindowInfo[$index][3]
   $ivMax = $aSB_WindowInfo[$index][7]
   ExitLoop
  EndIf
Next
If $index = -1 Then Return 0
Local $tSCROLLINFO = DllStructCreate($tagSCROLLINFO)
; Retrieve the dimensions of the client area.
$xClient = BitAND($lParam, 0x0000FFFF)
$yClient = BitShift($lParam, 16)
$aSB_WindowInfo[$index][4] = $xClient
$aSB_WindowInfo[$index][5] = $yClient
; Set the vertical scrolling range and page size
DllStructSetData($tSCROLLINFO, "fMask", BitOR($SIF_RANGE, $SIF_PAGE))
DllStructSetData($tSCROLLINFO, "nMin", 0)
DllStructSetData($tSCROLLINFO, "nMax", $ivMax)
DllStructSetData($tSCROLLINFO, "nPage", $yClient / $yChar)
_GUIScrollBars_SetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO)
; Set the horizontal scrolling range and page size
DllStructSetData($tSCROLLINFO, "fMask", BitOR($SIF_RANGE, $SIF_PAGE))
DllStructSetData($tSCROLLINFO, "nMin", 0)
DllStructSetData($tSCROLLINFO, "nMax", 2 + $xClientMax / $xChar)
DllStructSetData($tSCROLLINFO, "nPage", $xClient / $xChar)
_GUIScrollBars_SetScrollInfo($hWnd, $SB_HORZ, $tSCROLLINFO)
Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_SIZE
Link to comment
Share on other sites

I think I have found a bug

In this case it is not a bug.

In the first post stated:

Note:

Includes Helper does not processing functions and variables as strings (functions Execute, GUIRegisterMsg, etc.) because of what may be the wrong results.

The next version will add the processing of explicit string values ​​(specified without the use of variables and expressions)

Link to comment
Share on other sites

I have test your new version 1.2.3

But it doesn`t work.

Testskript

Global $array[5]
_ArrayDisplay($array)

Result with 1.2.1

#Region ;************ Includes ************
#Include <Array.au3>
#EndRegion ;************ Includes ************
Global $array[5]
_ArrayDisplay($array)

Console

>INCLUDES HELPER

C:test04.au3

! NEED INCLUDED :

#Include <Array.au3>

>Exit code: 0 Time: 39.519

IncludesHelper.ini

[General]

ShowOptimInfo=1

ShowDetals=0

ResultToSource=1

Result with 1.2.3

Global $array[5]
_ArrayDisplay($array)

Console

>INCLUDES HELPER

C:test04.au3

->

Global $array[5]

_ArrayDisplay($array)

>Exit code: 0 Time: 39.922

IncludesHelper.ini

[General]

ShowOptimInfo=1

ShowDetals=0

ResultToSource=1

Edited by Tweaky
Link to comment
Share on other sites

I have found a new bug :)

result of first use

#Region    ;************ Includes ************
#Include <Array.au3>
#EndRegion ;************ Includes ************
Global $array[5]
_ArrayDisplay($array)

Result of second use

#Region    ;************ Includes ************
#Include <Array.au3>
#Include <Array.au3>
#EndRegion ;************ Includes ************
Global $array[5]
_ArrayDisplay($array)

Result of third use

#Region    ;************ Includes ************
#Include <Array.au3>
#Include <Array.au3>
#Include <Array.au3>
#EndRegion ;************ Includes ************
Global $array[5]
_ArrayDisplay($array)

The old includes will not be deleted.

Link to comment
Share on other sites

First of all great work.

I like it although it is very slow.

I'll have a look if I optimze my version, or whether I have to switch to your version and try to give you some tips for improvements instead.

Besides, the problem that OI shows every include a function is used of is no problem, because most people use obfuscator to strip unneeded code before compilation.

Edited by Xenobiologist

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

Xenobiologist

Thank you very much for the "Organize Includes" - a long time I used it.

it is very slow.

Script of 3000 lines processed about 4 seconds (if the database has been created and files are needed only in the folder "Include").

I do not think that it is very slow, small files are processed almost instantly.

Creating a database and scan a script folder is really quite slow, since uses native the function AutoIt, i try to use "Scripting.Dictionary" - the processing speed must be increased substantially.

try to give you some tips

I am always happy to advice.

Besides, the problem that OI shows every include a function is used of is no problem, because most people use obfuscator to strip unneeded code before compilation.

I agree. The real result - only more tidy code.
Link to comment
Share on other sites

Why not use $UserIntLang = @OSLang ?

All right. ("GetUserDefaultUILanguage" use out of habit :) )

The next version will correct.

why script want replace each time GUIConstants.au3 by GUIConstantsEx.au3 ?

If look the file guiconstants.au3 - all will become understandable:

#include-once

; #INDEX# =======================================================================================================================
; Title .........: GUIConstants
; AutoIt Version : 3.2
; Language ......: English
; Description ...: This file is deprecated.  GUIConstantsEx.au3 should be used.
; Author(s) .....: Valik
; Dll ...........:
; ===============================================================================================================================

#include "GUIConstantsEx.au3"

This is whole file.

Link to comment
Share on other sites

It's bad practice to use GUIConstants.au3 instead of GUIConstantsEx.au3 and the fact GUIConstants.au3 is still there was due to people complaining it would break their scripts if removed. If something is deprecated then the general rule of thumb is don't use it and since this changed happened in V3.2.12.0 it's suffice to say no one is probably using GUIConstants.au3 anymore.

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

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