Jump to content

Constants Generator


FuryCell
 Share

Recommended Posts

This script takes a constants file and generates a new one with the only constants needed by your script. This is useful as it might speed up your script and shave off a few kb as well.It has a problem with tabs being in the value of the constants as it will delete them. You can turn off this option if tabs are only in the value by creating an ini called config.ini that looks like this.

[Main]
RemoveTabs=0
This works fine for GuiConstants.au3 as it has not tabs in its values.If interest is high I plan to improve it.

Please let me know what you think.

-SolidSnake

Edit:Scroll Down to post #7 for the new version. (The tab problem is fixed.) :)

Edited by SolidSnake
HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.
Link to comment
Share on other sites

Cool!

<{POST_SNAPBACK}>

Thanks for the feedback.

I plan to add more features to it like remembering the last opened path and also get around the tab issue.

HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.
Link to comment
Share on other sites

Updated. Tab Problem Fixed. Ini file no longer used as there is no longer any problem with tabs. Also forgot to mention it supports command line parameters in the format:

ConstantsGenerator "Constants File" "Script File" "Output File"
Edited by SolidSnake
HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.
Link to comment
Share on other sites

Updated again. Fixed a bug where it always saved to out.au3.

Here is an example:

If you ran Constants Generator on this script with GUIConstants.au3:

If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000
Opt("GUIResizeMode",$GUI_DOCKLEFT+$GUI_DockBottom)


GuiCreate("Test", 220, 40,(@DesktopWidth-220)/2, (@DesktopHeight-40)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

$ButtonMB = GuiCtrlCreateButton("Show MsgBox", 0, 0, 220, 40)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $Msg=$ButtonMB
        MsgBox(0,"Test","This is a test.")
    Case Else
    ;;;
    EndSelect
WEnd
Exit

It would generate a new GUIConstants.au3 that looks like this:

Global Const $GUI_EVENT_CLOSE            = -3
Global Const $GUI_DOCKLEFT            = 0x0002
Global Const $GUI_DOCKBOTTOM        = 0x0040
Global Const $WS_OVERLAPPED         = 0
Global Const $WS_OVERLAPPEDWINDOW    = 0x00CF0000
Global Const $WS_CLIPSIBLINGS        = 0x04000000
Global Const $WS_VISIBLE            = 0x10000000

I've also seen 4kb shaved off the size of the compiled script and a 3% increase in script startup speed.

Edited by SolidSnake
HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.
Link to comment
Share on other sites

Updated Again. Added:

-A GUI

-Ability to remember last opened files.

-a progress bar

-an Icon

here are some pics:

Note:Made this post a few days ago but hit the delete button by mistake so I had to post it again.

Edit: Pics and Zip removed. Get the new version from the post below.

Edited by SolidSnake
HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.
Link to comment
Share on other sites

Updated again. Fixed the ? in the results MsgBox(). Meant for it to have an I and it now shows you a percent reduction for the new constants file.

Here are some Pics.

ConstGen.zip

Edited by SolidSnake
HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.
Link to comment
Share on other sites

  • 9 months later...
  • 1 year later...

Well it's been a long time and I think the Constants Generator has been abandonned.

Since 3.2 you have to pick each constants file individually :).

So here's a little DOS magic for you out there:

CD C:\Program Files\AutoIT3\Include
COPY *constants.au3 allconstants.au3

Then choose allconstants.au3 as your Input Constants File.

BEWARE: These constants are made into includes so that new values and bugs are easy to implement. By manually integrating these constants into your program you will not benefit from these changes (although I'm betting nothing much will happen ehehehe).

If you have no idea what this is then you probably should not mess with this!

I am endeavoring, ma'am, to construct a mnemonic circuit using stone knives and bearskins.SpockMy UDFs:Deleted - they were old and I'm lazy ... :)My utilities:Comment stripperPolicy lister 1.07AutoIT Speed Tester (new!)

Link to comment
Share on other sites

Well it's been a long time and I think the Constants Generator has been abandonned.

Since 3.2 you have to pick each constants file individually :).

I just do it by right clicking on the script and using SendToA3X which has a Constants Generator based on SolidSnake's Constants Generator code.
Link to comment
Share on other sites

I just do it by right clicking on the script and using SendToA3X which has a Constants Generator based on SolidSnake's Constants Generator code.

And I taught I was so smart :)

Hey I remember installing this a while ago ... didn't know it could do that ... maybe it couldn't back then.

I am endeavoring, ma'am, to construct a mnemonic circuit using stone knives and bearskins.SpockMy UDFs:Deleted - they were old and I'm lazy ... :)My utilities:Comment stripperPolicy lister 1.07AutoIT Speed Tester (new!)

Link to comment
Share on other sites

I just do it by right clicking on the script and using SendToA3X which has a Constants Generator based on SolidSnake's Constants Generator code.

Glad to see my old code is being put to use. :)

HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.
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...