Jump to content

Auto3Lib


PaulIA
 Share

Recommended Posts

:lmao:

How can the _PopupGetParent() help with that? I thought context menus and other popups (like comboboxes, drop down menus, etc) were child windows of the desktop, and that was why you couldn't get at them through EnumChildWindows using the current window handle as the starting point?

I believe you when you say it works, but could someone clear that up for me?

Also... say I wanted to locate a particular item in a context menu. (Assume that for demo purposes, shortcut keys are not an option)

1) Move the cursor over the source point and right click

2) Identify the popup menu

3) Retrieve a list of the item text (to check against a list)

4) Verify whether a particular item is available or grayed (say, "&Delete Selected Records")

5) Determine the rectangle occupied by a particular item in that menu (say, "&Export")

6) Move the cursor to the midpoint of that item and left click

#1 and #6 are very easy, and you just explained #2, but have you been successful at #3-5?

Also, does this work with non-standard menus and non-standard toolbars, like if a regular windows control has been subclassed? How much of this is class-dependant?

Gotta hand it to you, I just get more excited about this thing...

(BTW, someone may ask why I'm not just experimenting. Besides the sudden and humbling realization I barely know what is going on at the Win32 level, at this phase in the project I'm not given a lot of time for experiments, and I'm really just "scouting ahead" for the next phase in our automation software. I do try to learn in my spare time, and may I say these UDFs look like a great way to do that, too.)

Link to comment
Share on other sites

You are correct about the popups being child windows. That's the whole purpose behind the _PopupScan function. I wrote an _EnumWindows function (A3LWinSDK) that enumerates all windows, including child windows. To find the popup windows, you enumerate starting with the desktop. What _PopupScan does is take a snapshot of all the open popup windows before a button is clicked. After you click the button, it takes another snapshot looking for new popup windows. Any new popup windows it finds are stored in the global array I mentioned. The _PopupGetMenu function returns a menu handle from this global array. The _PopupGetHandle function returns the parent of the menu (which you need for some of the menu functions). Lastly, the _PopupGetType function tells you whether the menu handle is a #32768 window (standard popup menu) or a handle to a ToolbarWindow (which is used by Microsoft to emulate a popup menu).

All of the items you listed (1-6) are handled in Auto3Lib. In fact, most of them are used in the examples that are included with the library. Between A3LToolbar and A3LMenu, all of the toolbar and menu functions are fully exposed. What I've done is come up with the "magic" that Birch is referring to that allows you to marry the two together. So when you click on a "menu" (regardless of whether it's a toolbar or a true menu) Auto3Lib will capture any popups for you, tell you what the popups are and then you can do whatever you want using either Toolbar or Menu commands.

As for subclassing, the answer would be no. Auto3Lib uses class names to determine which windows are menus, toolbars, etc. But if you look at the _PopupScan code, you'll see where I use a switch statement which allows you to add other window classes to the list of the ones I'm looking for. So if you subclass a Toolbar, you'd just add your class name to the switch statement. If there is a lot of demand for such a feature, I will change the library so that you can register the class names of the windows you want to track.

I don't mind the questions at all. This is suppose to be a support forum and if you've got questions, you should be able to ask them without fear of getting blasted. :lmao:

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

I have released a new version of Auto3Lib that includes full support for SysListView32 controls. As always, appropriate comments/suggestions are welcome.

Hey PaulIA you are BIG man! :lmao:

I quickly looked into your ListView stuff and it's great.

I can't wait to test it.

Thanks for that. It's really much of work.

Link to comment
Share on other sites

@Zedna: Thank you for the feedback. Let me know how it works out for you.

Added SysHeader32 control. If anybody that is using Auto3Lib has suggestions/comments for enhancements or future controls to implement, let me know.

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

Thank you for the comments and feedback. :lmao:

I will continue to expand Auto3Lib as the need arises or as I get requests. I'm looking at adding ComboBox, ListBox or Tab Control next, but would be interested if any of the users have other suggestions or recommendations.

In looking back over the library, I see several places where I need to be more mindful of setting @Error, so I will be doing that in the next few weeks too.

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

  • 2 weeks later...

Are you still taking suggestions?

You already have the commands wrapped to get a handle for an associated tooltip control; adding more tooltip-related commands would be a great addition for this library, and especially to the Toolbar32. You could get text identifiers for toolbar buttons that don't have their own text set, the same way a user would - by looking at the tooltip!

I'm curious, how do you crank this stuff out so easily, PaulIA? What is your programming background?

Edited by sohfeyr
Link to comment
Share on other sites

Yep, still taking suggestions (at least the appropriate ones) ;)

I was looking at the Tooltip control last night, so I'll see what I can do in the next week or two.

As far as background, let's just say when I started programming, saving your code to paper tape was "high tech", a 1 Mhz processor was "awesome" and we routinely coded a million lines of assembly code into 64K of address space (with space left over).

God... am I really that old? :whistle:

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

Anything special you want for the ToolTips control beside the basic mapping of all the messages? I worked on it last night and I'm able to track when a tooltip pops up, read the text, move it around, etc.

Well, since you asked, there are a few functions I had in mind to further wrap it... they might be useful to more people than just me, if you wanted to implement them:

Func _ToolTip_GetTextAt($tooltipHwnd, $x, $y, [$coordmode=1], [$param1=0])oÝ÷ ÚéeMú¶%¶*GÂwb²Ø^­ë.Ú²¶§X¤y:(¶«ëS¢måX´ß¬ZÝ7ë&«yÊ(­Ø§j׬þX¥Múr+vjy§zljö¥¹ë)yÈÊ)à­éZ¶+Þ¶­ç§Ö·¥jدzÚrد{§v6¢ºÞ«b½ëh¶¢{[)yÈçbMú¥ªÚ]ÿ)bÓ~©j¶¦Ö+uØ­Ú)ß¡ú+Ó~¢Ý^²ç!jÆ¢{k¢XZÙ^þX¿ºTáÌ(ºWkzÛ«Ø^µìm¡ûazÚ(Ø©Â
.Ö©¥æ«jÖ©j»bréZ®Zjب­­ç²Æ« ¢)ණ{­Ø^rê좶®¶­sdgVæ2õFööÅFôÖ÷W6TÖ÷fTWV7Bb33c·Âb33c·Â²b33c·6V75FõFÖV÷WCÓ5Ò²b33c¶6ö÷&FÖöFSÓÒ²b33c·&ÓÓÒ
  • all pretty self-explanatory, since the four of them are the same as before.
This would return a two-element array containing the handle of the window that appears and the text of the tooltip. If it did not appear before the timeout elapsed, the contents would be zero and zero. It might be really cool to have a third element in that array that gives the elapsed time between the MouseMove and the tooltip appearing, and maybe a fourth with the LTWH or LTRB rectangle of where it appears (since it might have disappeared by the time a WinGetPos command was called on the handle).

If I had to give them a priority, I'd say the second was more important to me since it has the visual element (more impressive for demoing).

Thanks for offering!

Edit:

I've found that something is funky with AutoIt's built-in time delays on some hyperthreading and multiprocessor machines. You TOTALLY have my permission if you want to include / wrap / use my time delay routines here. (If you have your own, I'll understand.)

Edited by sohfeyr
Link to comment
Share on other sites

For _ToolTip_GetTextAt, are you after the text that will get displayed at X, Y if the mouse were moved there? Isn't the message that is displayed at an X/Y coordinate controlled by the application? I mean that, I can read the text of a ToolTip, but if the mouse moves over another control, doesn't the application reuse the ToolTip window and just modify the text? If that were true, I wouldn't be able to tell what the text at a given X/Y coordinate would be without actually moving the mouse.

Insight, anybody?

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

For _ToolTip_GetTextAt, are you after the text that will get displayed at X, Y if the mouse were moved there? Isn't the message that is displayed at an X/Y coordinate controlled by the application? I mean that, I can read the text of a ToolTip, but if the mouse moves over another control, doesn't the application reuse the ToolTip window and just modify the text? If that were true, I wouldn't be able to tell what the text at a given X/Y coordinate would be without actually moving the mouse.

Insight, anybody?

I had assumed this would be possible by obtaining the handle of the topmost control at X, Y (there is something that does this in AutoIt Wrappers in the Scripts and Scraps forum), and then using the TTM_GETTOOLINFO message. But then, if you're stymied I'm way out of my league...

If PaulIA = ;) Then sohfeyr = :whistle:

It might be best to just move the mouse anyways.

Off-topic edit: seriously, aren't these emoticons great? Wish I had them on MSN

Edited by sohfeyr
Link to comment
Share on other sites

Added support for ToolTip controls. Take a look at the demo to see all the utterly useless things you can do to a poor ToolTip control.

Great! I`ll have a play with this when I get time. :whistle:

2015 - Still no flying cars, instead blankets with sleeves.

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