Jump to content

How to convert GUI scripts to v3.2.12.0


Jon
 Share

Recommended Posts

  • Administrators

Thanks Mike.

That worked. I just assumed it should have been fine in the first place being a sample au3 script that was installed during the setup.

Damn, I thought I'd checked them all. Thanks.
Link to comment
Share on other sites

  • Replies 69
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

I'm wanting to use the IE builder program but I get an error message found here: http://www.autoitscript.com/forum/index.php?showtopic=71705

What # < includes > do I need to add to the script?

Regards.

It looks like you need, StaticConstants.au3, but you could also try running it through my script on page one as it will fix all the constants you need :)

Edited by monoceres

Broken link? PM me and I'll send you the file!

Link to comment
Share on other sites

Great work with fixing "#include" :)

... now I have to work on changing command names (e.g. _GUICtrlListViewGetItemText= _GUICtrlListView_GetItemText) and in some cases parameter's order ... :) ... and I have only a "couple" scripts over 3k lines ...

That's not so bad ... I will fix them sometime.

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Link to comment
Share on other sites

Needs some more detail, and maybe a step by step guide of how to convert a couple of scripts - please reply to this thread with suggestions/drafts of how this post should look and I'll update. This is to help with the inevitable flood of questions when 3.2.12.0 is released.

Here is one version of Step by Step (to add the needed includes):

In v3.2.12.0 a number of changes were made to the include files used for the GUI:

  • GUIConstants.au3 is identical to GUIConstantsEx.au3. This means that many scripts using advanced GUI functionality will need to use additional #include statements to include files containing constants that were previously and erroneously included.
  • GUIDefaultConstants.au3 no longer exists. You must now #include the corresponding individual constants file for the control type you need.

How you can find out what includes are needed for your script:

  • First of all open AutoIt install dir, go to the Include dir, and open the Search tool (F3).
  • Now run a "Syntax Check" for your script (from SciTE's Tools menu).
  • To jump to the next error press F4, and look at the variable (Constant) that error is pointing on (above the "~~~~~~~^" or "ERROR ^").
  • Now copy/remember that variable, go to the Search folder that you open previously, and type under "Search Text" the copied variable, and press Search.
  • You will see now the #include File that got your variable, so now you know what #include your script is missing, add it.
  • After few "error jumps" and adding new #include files, you can repeat the "Syntax Check" operation to narrow the error results.
  • Repeat steps 2, 3, 4, 5 untill you got no errors.

Perhaps need more polishing/corrections, but this is only an idea.

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

Great work with fixing "#include" :)

... now I have to work on changing command names (e.g. _GUICtrlListViewGetItemText= _GUICtrlListView_GetItemText) and in some cases parameter's order ... :) ... and I have only a "couple" scripts over 3k lines ...

That's not so bad ... I will fix them sometime.

I have the name change one already done if it will help you. I'm onto the next steps.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Can I just ask why this was done? I'm sure there's a good reason, but I just can't think what it might be...

Surely one include was better than two, three or sometimes more?

I'm slightly miffed that now I have to go back and amend all my GUI scripts that worked just fine before...

Link to comment
Share on other sites

I think it was due to the fact that a lot of things were included in GUIConstants that were redundant in most scripts.

If that is not a concern for you then you could always replace your GUIConstants in the include folder with this:

#include-once
#include <AVIConstants.au3>
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <Constants.au3>
#include <DateTimeConstants.au3>
#include <EditConstants.au3>
#include <FontConstants.au3>
#include <GDIPlusConstants.au3>
#include <GUIConstants.au3>
#include <GUIConstantsEx.au3>
#include <HeaderConstants.au3>
#include <ImageListConstants.au3>
#include <IPAddressConstants.au3>
#include <ListBoxConstants.au3>
#include <ListViewConstants.au3>
#include <MemoryConstants.au3>
#include <MenuConstants.au3>
#include <ProgressConstants.au3>
#include <RebarConstants.au3>
#include <ScrollBarConstants.au3>
#include <SecurityConstants.au3>
#include <SliderConstants.au3>
#include <StaticConstants.au3>
#include <StatusBarConstants.au3>
#include <StructureConstants.au3>
#include <TabConstants.au3>
#include <ToolbarConstants.au3>
#include <ToolTipConstants.au3>
#include <TreeViewConstants.au3>
#include <UpDownConstants.au3>
#include <WindowsConstants.au3>

But beware!

On my computer the startup time for my scripts grew from 0.17 ms to 9.5 ms when using this instead of just GUIConstantsEx.

:)

Edited by monoceres

Broken link? PM me and I'll send you the file!

Link to comment
Share on other sites

Can I just ask why this was done? I'm sure there's a good reason, but I just can't think what it might be...

Surely one include was better than two, three or sometimes more?

I'm slightly miffed that now I have to go back and amend all my GUI scripts that worked just fine before...

One include is not always better than two. There are in excess of 3200 Constants used, why would you want to include all those that your script does not require? For example if your script does not use a ListView control, then why include all of the ListView constants? If you look in Example scripts I have a #Include updater that has not missed yet. It may be somewhat slower than others but the accuracy seems better and you can just pass it an array of file names and get them all done at one time.

Edit: and it was particularily irksome when people used to #include the old GUIConstants file, which #included the list monoceres pointed to above, for the sake of only using one of those constants (usually GUIEventClose) and there was no need for a constants file to be included at all. They could have just put the value of the constant in.

Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

In v3.2.12.0 a number of changes were made to the include files used for the GUI:

  • GUIConstants.au3 is identical to GUIConstantsEx.au3. This means that many scripts using advanced GUI functionality will need to use additional #include statements to include files containing constants that were previously and erroneously included.
  • GUIDefaultConstants.au3 no longer exists. You must now #include the corresponding individual constants file for the control type you need.

Needs some more detail, and maybe a step by step guide of how to convert a couple of scripts - please reply to this thread with suggestions/drafts of how this post should look and I'll update. This is to help with the inevitable flood of questions when 3.2.12.0 is released.

Is it possible to add the correct <#include> in the Help file,... like the others includes ???

Thanks for your wonderful work !

C.

Link to comment
Share on other sites

  • Developers

I am thinking about adding the idea of monoceres into AutoIt3Wrapper and update a script one time when a directive is specified.

I took the original script/idea and created this UDF. Its somewhat faster but could you folfs give it a spin to see if it works as it should be?

Directive will be : #AutoIt3Wrapper_Fix_Includes=y

Which will be reset to "n"when ran to avoid running it each time.

#include <File.au3>
Global $Lines2Add
$ScriptFile_In = FileOpenDialog("Choose script that will be fixed", @ScriptDir, "au3 (*.au3)")
;~ $autoitdir = FileSelectFolder("Autoit Include folder", "")
$INP_AutoitDir = RegRead("HKLM\Software\AutoIt v3\Autoit", 'InstallDir')
Fix_Includes()


Func Fix_Includes()
    ConsoleWrite("+ Check for missing include files:")
    Local $includelines, $scriptdata
    Local $count = 0, $const
    $scriptdata = FileRead($ScriptFile_In)
    Local $includes = _FileListToArray($INP_AutoitDir & "\include", "*Constants*.au3")
    For $i = 1 To UBound($includes) - 1
; don't include GUIConstants.au3
        If $includes[$i] = "GUIConstants.au3" Then ContinueLoop
; Skip already included Include files
        If StringRegExp($scriptdata, "(?s)#include(\s*?)<" & $includes[$i] & ">", 0) Then ContinueLoop
; Get all Constants from include file into Array
        Local $ConstArray
        $ConstArray = StringRegExp(FileRead($INP_AutoitDir & "\include\" & $includes[$i]), "(?i)Global[\s]Const[\s](.*?) = ", 3); '<(?i)test>(.*?)</(?i)test>'
        For $j = 1 To UBound($ConstArray) - 1
            If StringRegExp($scriptdata, "(?s)\" & $ConstArray[$j] & "", 0) Then
                    $Lines2Add &= "#include <" & $includes[$i] & ">" & @CRLF
                    $count += 1
                    ExitLoop
            EndIf
        Next
    Next
; Added required Include statements to the Scriptfile plus some commentlines
    If $count Then
        Local $H_Outf = FileOpen($ScriptFile_In, 2)
        FileWriteLine($H_Outf, "; *** Start added by AutoIt3Wrapper ***" )
        FileWrite($H_Outf, $Lines2Add)
        FileWriteLine($H_Outf, "; *** End added by AutoIt3Wrapper ***")
        FileWriteLine($H_Outf, $scriptdata)
        FileClose($H_Outf)
    EndIf
    ConsoleWrite(" " & $count & " include(s) were added" & @CRLF)
; update directive to n to avoid running it each time
    $ToTalFile = @CRLF & FileRead($ScriptFile_In)
    $ToTalFile = StringRegExpReplace($ToTalFile, '(?i)' & @CRLF & '(\h?)#AutoIt3Wrapper_Fix_Includes(\h*?)=(.*?)' & @CRLF, @CRLF & '#AutoIt3Wrapper_Fix_Includes=n' & @CRLF)
    $H_Outf = FileOpen($ScriptFile_In, 2)
    FileWrite($H_Outf, StringMid($ToTalFile, 3))
    FileClose($H_Outf)
EndFunc ;==>Fix_Includes

:)

Edited 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

There are in excess of 3200 Constants used, why would you want to include all those that your script does not require? For example if your script does not use a ListView control, then why include all of the ListView constants?

Why not? What difference does it really make? I'm not being fastidious, I actually don't know!

If it's just about reducing a 9ms startup time (nine one-thousanths of a second?) then I think I could live with that!

Please don't get me wrong, I'm not criticising, I'm just trying to understand...

Link to comment
Share on other sites

Why not? What difference does it really make? I'm not being fastidious, I actually don't know!

If it's just about reducing a 9ms startup time (nine one-thousanths of a second?) then I think I could live with that!

Please don't get me wrong, I'm not criticising, I'm just trying to understand...

The more lines of code you add, including constants, the larger the file size.

In my own scripts (the ones I use, which may vary from the ones I release) I don't use constants at all. I replace them with actual values.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Why not? What difference does it really make? I'm not being fastidious, I actually don't know!

If it's just about reducing a 9ms startup time (nine one-thousanths of a second?) then I think I could live with that!

Please don't get me wrong, I'm not criticising, I'm just trying to understand...

There's also filesize. Tested compiled a script with just GUIConstantsEx and one with all the constants and the fileszie grew from 262,257 bytes to 333,187 bytes, now that is a lot!

Memory usage also increased, from 5680 kB to 7116 kB.

Some stats also:

Speed difference: ~5400%

Filesize difference: ~27%

Memory difference: ~25%

Hope you got some more answers :)

Broken link? PM me and I'll send you the file!

Link to comment
Share on other sites

Sure - that all makes sense. I guess it just comes down to what you use AutoIt for. Me, personally, I use it to automate various tasks at work, some installations, other just admin tasks to save time. But as I'm not releasing any scripts for public use (not because I'm mean, they're just designed proprietary to our environment) I guess I'm not that worried about their efficiency or overheads.

But I get your point so I'll shut up about it now - it just bugged me that I couldn't run an old script on a newly built machine with the latest AutoIt freshly installed! :)

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