Jump to content

Different script behavior between versions

Recommended Posts


I've recently changed PCs and while doing so I've updated the AutoIt to the latest version.

Old version was v3.3.12.0

New version is v3.3.14.5

I'm using AutoIt to control SAP GUI. While compiling a new script using the newest version I immediately noticed that the .exe is over 1MB while the old ones were 900KB+-50.

This script uses the SAP GUI's createSession() function which creates a new window, then I check whether that window is enabled with WinGetState() and stop if it's not enabled.

Running the script compiled with the newest version creates a new window but according to WinGetState() it is not enabled, this is true:

BitAND(WinGetState($win), 4) = 0

Running the script compiled with the old version creates a new window and WinGetState() correctly reports that it is enabled (the above check is false).

Full script can be found here: https://gist.github.com/morkai/1ff910502e36ecf60da2bbdff803d144

T_MD04.au3 includes _Logon.au3

then _Logon.au3 calls $sessioon.createSession() @ line 232

then _Logon.au3 calls FindFreeSession() @ line 253

then FindFreeSession() calls IsWinLocked() @ line 60

IsWinLocked() (defined in _Common.au3 @ line 23) returns true in v3.3.14.5 and false in v3.3.12.0

Link to post
Share on other sites

Just my own preference...rather than worrying about double negatives and such, you can do this instead

If BitAND(WinGetState($win), 4) Then
    ; Is Enabled

If Not BitAND(WinGetState($win), 4) Then
    ; Is Disabled

Sorry to not answer your question though.  Do you have a snippet that can reproduce without me having to trust a download?


Made a quick snippet:

$win = GUICreate("my test app")
GUISetState(@SW_SHOW, $win)

MsgBox(1,1,"I should be 0: [" & BitAND(WinGetState($win), 4) & "]")
MsgBox(1,1,"I should be greater than 0: [" & BitAND(WinGetState($win), 4) & "]")

@autoItVersion =

First return is 0

Second return is 4

Both are expected results.

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to post
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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...