Jump to content

Auto3Lib


PaulIA
 Share

Recommended Posts

Hi,

With debug, it ran without error. then turned debug off;

Debug does not seem to work, or only intermittently!

Here it is [in attached file] with ALL lines in that func remarked Except " _Lib_ConsoleWrite()" ;is that helpful?

It happens even with ShowListView turned off;

only if Both the following 2 funcs are turned on, not either one alone;

ClickItem()
InsertColumn()
$gbDebug = True
InsertItem()
;SetBackgroundImage()
;SetColumn()
;SetGroupName()
;SetItemImage()
;SetItemOverlay()
;~ ShowListView()
ShowColumns()
ShowItems()
Edited by randallc
Link to comment
Share on other sites

Hi,

With debug, it ran without error. then turned debug off;

Debug does not seem to work, or only intermittently!

Here it is [in attached file] with ALL lines in that func remarked Except " _Lib_ConsoleWrite()" ;is that helpful?

It happens even with ShowListView turned off;

only if Both the following 2 funcs are turned on, not either one alone;

Download the latest version and install it. Then modify the ListView 2 script and put the following line:

AutoIt$gbDebug = True

right before the call to ShowListView() in the Main section. When the error occurs, it will create a file called A3LDebug.txt in your AutoIt directory. Post the contents of that file so we can see what is going on.

:)
Auto3Lib: A library of over 1200 functions for AutoIt
Link to comment
Share on other sites

Hi,

Sorry about that again!

Here is your debug file;

and here are some of the combinations of commands which produce the error; you are right that it varies a lot; I presume a handle is not being released when another wants it or similar;

'ErrorReporting2.txt

This will produce the error;

;=========================================================

$gbDebug = True

ClickItem()

InsertColumn()

InsertItem()

ShowColumns()

ShowItems()

;=========================================================

But this is OK;

ClickItem()

;~ InsertColumn()

InsertItem()

;~ ShowColumns()

ShowItems()

;=========================================================

Error again;

ClickItem()

InsertColumn()

InsertItem()

;~ ShowColumns()

ShowItems()

;=========================================================

OK;

ClickItem()

;~ InsertColumn()

InsertItem()

ShowColumns()

ShowItems()

;=========================================================

OK;

ClickItem()

InsertColumn()

;~ InsertItem()

ShowColumns()

ShowItems()

;=========================================================

Error again; [if only this]

$gbDebug = True

ShowListView()

;=========================================================

06/03/2007 09:14:01 - _Mem_CtrlInit failed: 0x0007073E

06/03/2007 09:14:01 - Error ......: Invalid window handle.

06/03/2007 09:14:01 - Valid handle: False

06/03/2007 09:14:01 - Window class:

Link to comment
Share on other sites

Hi,

Sorry about that again!

Here is your debug file;

and here are some of the combinations of commands which produce the error; you are right that it varies a lot; I presume a handle is not being released when another wants it or similar;

No, it's what I suspected. The ListView handle being passed to the function isn't valid anymore. When a program creates a window handle, the handle is static until the program closes (or the program explicitly destroys it). The script obtains the handle of the Explorer ListView control ($hList) when it is launched. It then performs the various tests that you see being printed out to the console, using the same window handle for all of the calls.

The first line in the debug file contains the handle to the ListView control that was being used. The second line in the debug file is the error message returned from the OS the last time the ListView was called. The OS confirms that the window handle is no longer valid. The third line in the debug file are the results of calling the IsWindow API function, which again confirms that the handle no longer references a window. Just to be sure, we call GetClassName using the window handle and it confirms for the 4th time that the window handle does not reference to a window anymore.

There are two ways that this could happen. I'm assuming that you have more sense to be closing Explorer while the script is running, so I'm not going to waste time on that one. :) The other way would be if you are running the tests in such a sequence (by commenting out various lines) that Explorer is destroying the old ListView window and creating a new one while the script is still running.

We can confirm the second case by performing a simple test. In the ListView 2 script, write the $hList variable to the console (ie. "ConsoleWrite(Hex($hList))") right after it's obtained. Then, compare this value to the value being reported in the debug file. If the script is causing Explorer to destroy/recreate the ListView window handle the values should be different. If they are the same, then we have to go back to the first case, which means I get to beat you with a stupid stick. :)

P.S. I appreciate you sticking with this.

Edited by PaulIA
Auto3Lib: A library of over 1200 functions for AutoIt
Link to comment
Share on other sites

if you are running the tests in such a sequence (by commenting out various lines)

I am confused; why are you saying ""I am commenting out certain lines"?

A. You asked me to start commenting out lines to help debug the problem [as i undersood it].

B. It is your example script, freshly installed, that is causing hte problem, so any commenting out already present is not being done by me!

I will insert your lines when I get back to my computer and let you knnow your answer, but i can't see how that will help?

C. I can understand the confusion because this does not happen to most people or on most computers, but it is, nevertheless, your example script, and it happens to me as soon as I install fresh and run your example scripts; no modification or clicking on screens, windows or anything! I know there may be something wrong with my computer or Windaows installation, but i am presuming this error could happen to somebody else too at some stage?

Best, Randall

Link to comment
Share on other sites

Hi again!

OK, I have unistalled, re-installed, and ready to try your test script again fresh, no added comments [note; it still crashes the same]!;

Which line number would you like me to insert the consolewrite; and which line number the debug?

Randall

[PS - just to check; the listView 2 script is dated 3rd June07 3:48pm ; 4th May07 4:26pm is that correct?

The fresh example scripthas these comments, in this order; is that what you expect?

ClickItem()
InsertColumn()
InsertItem()
;SetBackgroundImage()
;SetColumn()
;SetGroupName()
;SetItemImage()
;SetItemOverlay()
ShowListView()
ShowColumns()
ShowItems()
] Edited by randallc
Link to comment
Share on other sites

Let's take this one step at a time. I'm not saying that there isn't a bug in the code somewhere. I just can't find it from the information that you've posted so far and nobody else seems to be having a problem. Since I can't reproduce the problem, I'm going to have to rely on you to be my eyes. I'm sure that we can figure out what is going on here in a short order.

Starting with the latest production release (3.2.4.9) of AutoIt and the latest release (4.0.9) or Auto3Lib, here is what I want you to do. Modify the ListView 2 demo script and add the following two lines of code:

$gbDebug = True
_Lib_DebugLog("Original ListView handle: 0x" & Hex($hList))oÝ÷ Ú¸ Öµêíéb殶­sbb33c¶FööÆ&"ÒõFööÆ&%ôfæEFööÆ&"gV÷C´×6ö×WFW"gV÷C²ÂgV÷C²f×´fÆRgV÷C²

This will write the original ListView handle to the debug file and enable debugging for the script. Then, run the script until it crashes and post the A3LDebug.txt file from your AutoIt directory.

Auto3Lib: A library of over 1200 functions for AutoIt
Link to comment
Share on other sites

OK, thanks. -file attached

I have been thinking about this computer;

1. Hardware unusual? - probably not; old PentiumD dual, 2 HD in RAID0

2. Windows settings?- perhaps, as I remember adjusting the time to hover over an item (eg on start up menu, filenames in explorer etc, ) to very quick; I wonder if it affects re-adjusting to a new window handle quicker than other computers which have been using this script? - perhaps there needs to be some way of re-activating/ focussing the window for handle required before the next call if the same handle has been lost?

Best, randall

Link to comment
Share on other sites

OK, thanks. -file attached

I have been thinking about this computer;

1. Hardware unusual? - probably not; old PentiumD dual, 2 HD in RAID0

2. Windows settings?- perhaps, as I remember adjusting the time to hover over an item (eg on start up menu, filenames in explorer etc, ) to very quick; I wonder if it affects re-adjusting to a new window handle quicker than other computers which have been using this script? - perhaps there needs to be some way of re-activating/ focussing the window for handle required before the next call if the same handle has been lost?

Best, randall

I'm going to PM you a script to run on this machine. Speed wouldn't have anything to do with this problem. The ListView handle is being destroyed before the script finishes and we need to figure out why.
Auto3Lib: A library of over 1200 functions for AutoIt
Link to comment
Share on other sites

PaulIA

What do you think on posting the library without installer?

To me it would be helpful (for me ;-)

Thanks for your great toil.

The earlier versions came without the installer, but a lot of people couldn't handle the "copy this here and this here" concept, so I included an installer. I understand your pain and believe me, the installer is a pain to maintain for me too, but it's necessary.
Auto3Lib: A library of over 1200 functions for AutoIt
Link to comment
Share on other sites

Release 4.0.10

This release contains the following changes/additions to the ListView controls:

  • Fixed a bug in several of the functions that were not marshalling memory correctly with external controls.
  • Fixed a syntax error in the ListView 1 demo. (Thanks randallc)
  • Changed the ListView 2 demo to handle machines with "Single click to open" enable in Explorer. (Thanks randallc)
  • Added code to the ListView 2 demo that shows how to build a context menu when you right click an item.
  • Added code to the ListView 2 demo that shows how to alter the control by using custom drawing.
Added a couple of new scripts in the Misc directory.
Auto3Lib: A library of over 1200 functions for AutoIt
Link to comment
Share on other sites

He already has, sort of.

I've already posted this in response to your question in a separate thread, but I wanted to cross-polinate in case some of the folks here wanted to know, too.

To get stuff from context menus, try this:

#include <A3LMenu.au3>;the source of much goodness. 
                                 ;Can be found here:  
                                 ;http://www.autoitscript.com/forum/index.php?showtopic=33677

Opt("WinTitleMatchMode", 4); Option required to be able to match window by classname

; Code to launch the context menu 
; this can be arbitrarily complex, but don't forget that using 
; ControlSend("<title", "", "<controlID>", "{APPSKEY}") can be just as effective

$hWnd = WinGetHandle("classname=#32768"); Part one of the magic - this is the classname for popups.

$hMenu = "0x" & Hex(_SendMessage($hWnd, $MF_GETHANDLE, 0, 0)); Part two of the magic            
; where _SendMessage is found in Paul Campbell's Windows SDK 
; library routines (A3LWinSDK.au3)

$text = _Menu_GetMenuString($hMenu, 0, $MF_BYPOSITION)
MsgBox(4096,"", "Menu item text: " & $text)

Also, to give proper credit to everybody, I would like to point out that the second part of the magic was lifted from Paul Campbell's _PopupScan() function (also in A3LWinSDK.au3), though I would not have known to steal it without Christian ASTOR's comment and Kuc's reply in this thread: http://groups.google.com/group/microsoft.p...bf6f15e26a7d3a/

I would further like to point out that Mr. Campbell has some interesting code in A3LMenu.au3 that makes me wonder how difficult it will be to select items from submenus of context menus. However, since I don't have any applications right now that have that feature, I'll not worry about that until I get there.

I would finally like to point out that Mr. Campbell has also done some very interesting things with ToolbarWindow32 in case that's a sticking point for you as well.

To sum up . . .

- use Paul Williams AU3 libraries

- "classname=#32768" is the secret to getting the handle to the context menu window

- (_SendMessage($hWnd, $MF_GETHANDLE, 0, 0)) is the secret to getting the handle to the context menu

- hope this helps

- thank you again, Mr. Campbell!

I can't find $MF_GETHANDLE in A3LMenu.au3. Maybe A3LMenu.au3 was updated.

Edited by circcc
Link to comment
Share on other sites

I can't find $MF_GETHANDLE in A3LMenu.au3. Maybe A3LMenu.au3 was updated.

Really, really old piece of code there. :) All you need to do is call _Lib_PopupGetHWND() to get the menu handle of the current popup menu on the screen. You can then use that handle in any of the calls in A3LMenu. You can also use the _Menu_ClickPopupxxx calls to directly click on any popup menu item. If that doesn't cover it, drop me a note.
Auto3Lib: A library of over 1200 functions for AutoIt
Link to comment
Share on other sites

The earlier versions came without the installer, but a lot of people couldn't handle the "copy this here and this here" concept, so I included an installer. I understand your pain and believe me, the installer is a pain to maintain for me too, but it's necessary.

I ment that both concepts are entitled to live. So it would be great to let people choose what is better for each.

I am for download alternative.

Link to comment
Share on other sites

I ment that both concepts are entitled to live. So it would be great to let people choose what is better for each.

I am for download alternative.

The clueless people killed the download alternative already. :)
Auto3Lib: A library of over 1200 functions for AutoIt
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...