Acc library: Ideas for new functions.

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Acc library: Ideas for new functions.

21 Dec 2017, 14:37

- I don't have any particular plans to add new functionality to the Acc library.
- However, I am intending to write a few basic functions, and to go over the code for Acc.ahk and AccViewer at some point.
- So I'm starting this thread in case anyone has any ideas regarding new functionality for the library.
- Note also that sancarn has been working on a new version of Acc:
AccV2 - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=40532
- Note: If you have a specific program that you want to get text from, via Acc, then start a new thread in Ask For Help, don't post anything here. Thanks.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
Georgie Munteer

Re: Acc library: Ideas for new functions.

21 Dec 2017, 16:36

jeeswg wrote:- I don't have any particular plans to add new functionality to the Acc library.
- However, I am intending to write a few basic functions, and to go over the code for Acc.ahk and AccViewer at some point.
- So I'm starting this thread in case anyone has any ideas regarding new functionality for the library.
- Note also that sancarn has been working on a new version of Acc:
AccV2 - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=40532
- Note: If you have a specific program that you want to get text from, via Acc, then start a new thread in Ask For Help, don't post anything here. Thanks.
I am a big fan of your work. Here is the link for those wanting to see some of it. https://autohotkey.com/boards/viewtopic.php?f=6&t=40615

If I think of anything ill post.
SOTE
Posts: 1426
Joined: 15 Jun 2015, 06:21

Re: Acc library: Ideas for new functions.

21 Dec 2017, 23:02

Would like to be able to get tooltip information when over a control and store it into a file. Something that would work over multiple applications, to include both Microsoft (Word, Notepad, Edge, etc...) and non-Microsoft apps (like Firefox, VLC, etc..).
sancarn
Posts: 224
Joined: 01 Mar 2016, 14:52

Re: Acc library: Ideas for new functions.

22 Dec 2017, 04:33

SOTE wrote:Would like to be able to get tooltip information when over a control and store it into a file. Something that would work over multiple applications, to include both Microsoft (Word, Notepad, Edge, etc...) and non-Microsoft apps (like Firefox, VLC, etc..).
This would be great, although sadly I'm not sure there is a standardised method... I mean with most win32 tooltips appear inside window 0x100CC with a tooltip role. However, in Excel (for example), Comments appear to be some other UI element (not sure which) and the same is true for screentips (while hovering over a ribbon item). I'd expect these are children of Excel itself, but not certain. One thing is for sure though, UIAutomation's tooltip watcher doesn't detect these popups.

Finally in Firefox, Chrome and probably Edge etc. there are no standards for tooltips. They differ from page to page, as all tooltip behaviour (I believe) is derived by the html, css and js of the site in question.
jeeswg wrote:Acc library: Ideas for new functions.
Some simple wrappers around the win32 message apis might be handy:

Acc_Click(),Acc_RClick(),Acc_MClick(),Acc_Context(),Acc_Scroll(amount)

It'd be nice if we can add event handlers to acc libraries. E.G.

Acc_OnFocus: (listens to EVENT_OBJECT_FOCUS),Acc_OnSelection (listens to EVENT_OBJECT_SELECTION
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Acc library: Ideas for new functions.

22 Dec 2017, 06:12

- @SOTE: I believe you mean: get general info and show it in ToolTips, rather than get information from ToolTips.
- AccViewer updates the name/value fields as you move the mouse. Also, AccViewer Basic, does the same thing. In case they're useful.
Acc library (MSAA) and AccViewer download links - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=26201
AccViewer Basic - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=32039
- Also, for various common controls, and context menus, particularly for getting text from lists of items, although potentially less useful for modern controls, is JEE_AccCtlGetText. Note: sometimes it only gets text from visible items, and not all items.
GUIs via DllCall: get/set internal/external control text - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=40514

- @sancarn: Re.:
AccV2 - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 35#p190035
- I don't know if this is possible with either UI Automation or Acc, but one potential area of interest would be to be able to retrieve the left/right caret positions in a control/element, that way you could retrieve text before/in/after a selection, or text in a selection and a bit either side of it.
- To simply be able to retrieve the selected text more generally would be useful. Although, this might be more program specific, or even specific to certain types of controls. E.g. maybe Visual Studio, or Excel, use certain control types also used by other programs, and it becomes more a question of finding specific methods for those controls, rather than using Acc.
- Also, to know that if you pressed ctrl+left/ctrl+right, what the new selection would be.

- @sancarn:
- I tried to do some stuff with carets in Internet Explorer, but unfortunately it didn't work. Although I did get an alternative method.
Internet Explorer: check if caret is visible (IHTMLCaret IsVisible) - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=39615
- A limitation of Acc is that it can do accDoDefaultAction, but I don't think it can do any other actions, e.g. right-click instead of left-click.
- Those 'Acc_' ideas you mentioned, are they functions that receive information rather than send information? Because if I had a function called RClick, I'd expect it to send a click, remember than monitor clicks.
- So the functions, is that so that when something is done in an external GUI, AHK receives information, a bit like in a window spy? Stuff like that you normally have to do via dll injection, right? I'm not sure what exactly you can do, and whether or not the difficulties are related to Acc, or to Winapi programming generally. If you have specific information about things you can do, then please provide links, and/or clarify what you hope to do, if you think it's possible. What would Acc_Context be for, context menus? Thanks.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
SOTE
Posts: 1426
Joined: 15 Jun 2015, 06:21

Re: Acc library: Ideas for new functions.

23 Dec 2017, 01:10

jeeswg wrote:- @SOTE: I believe you mean: get general info and show it in ToolTips, rather than get information from ToolTips.
I mean a tool that can gets information from ToolTips (including status bar or the proper name of whatever that's replaced is called in IE, task bar, etc...), even if it has to use a variety of ways to do it. Those ToolTips often store a wealth of information, which can be helpful in automation.
sancarn
Posts: 224
Joined: 01 Mar 2016, 14:52

Re: Acc library: Ideas for new functions.

24 Dec 2017, 13:29

jeeswg wrote: - I don't know if this is possible with either UI Automation or Acc, but one potential area of interest would be to be able to retrieve the left/right caret positions in a control/element, that way you could retrieve text before/in/after a selection, or text in a selection and a bit either side of it.
I know this isn't totally what you mean, but it might potentially be helpful either way:
https://www.codeproject.com/Articles/34 ... pplication

jeeswg wrote: - To simply be able to retrieve the selected text more generally would be useful. Although, this might be more program specific, or even specific to certain types of controls. E.g. maybe Visual Studio, or Excel, use certain control types also used by other programs, and it becomes more a question of finding specific methods for those controls, rather than using Acc.
- Also, to know that if you pressed ctrl+left/ctrl+right, what the new selection would be.
Yeah sounds pretty application specific to me... However UI Automation does have the following events:

SelectionItemPattern.ElementAddedToSelectionEvent
SelectionItemPattern.ElementRemovedFromSelectionEvent
SelectionItemPattern.ElementSelectedEvent
SelectionItemPatternIdentifiers.ElementAddedToSelectionEvent
SelectionItemPatternIdentifiers.ElementRemovedFromSelectionEvent
SelectionItemPatternIdentifiers.ElementSelectedEvent

It is possible that we could setup some persistant objects which track these changes and log them for others to analyse and use :)
jeeswg wrote: - I tried to do some stuff with carets in Internet Explorer, but unfortunately it didn't work. Although I did get an alternative method.
Internet Explorer: check if caret is visible (IHTMLCaret IsVisible) - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=39615
You shoul be able to use this. I'm not sure if this is what you tried or not though. It should work in all IE browsers including version 7 and below.
jeeswg wrote: - A limitation of Acc is that it can do accDoDefaultAction, but I don't think it can do any other actions, e.g. right-click instead of left-click.
- Those 'Acc_' ideas you mentioned, are they functions that receive information rather than send information? Because if I had a function called RClick, I'd expect it to send a click, remember than monitor clicks.
- So the functions, is that so that when something is done in an external GUI, AHK receives information, a bit like in a window spy? Stuff like that you normally have to do via dll injection, right? I'm not sure what exactly you can do, and whether or not the difficulties are related to Acc, or to Winapi programming generally. If you have specific information about things you can do, then please provide links, and/or clarify what you hope to do, if you think it's possible. What would Acc_Context be for, context menus? Thanks.
In these cases oAcc.click() or Acc_Click(oAcc) would perform the click action. Listener's I'd prefix with on. E.G. oAcc.OnClick.push(Func("someHandler")). Acc_Context would send the 'Context' message to the control. Acc_OnContext would be a listener for when the context menu was opened. I have done this in the past with UI Automation.
SOTE wrote: I mean a tool that can gets information from ToolTips (including status bar or the proper name of whatever that's replaced is called in IE, task bar, etc...), even if it has to use a variety of ways to do it. Those ToolTips often store a wealth of information, which can be helpful in automation.
In general, I wouldn't bother with pulling data from IE tooltips using AHK. I am personally a great believer in choosing the language built for the job, if possible. In some cases that isn't possible but in the case of IE, JavaScript is your best bet for extracting information from the IE webpage. And it is much more powerful and easy to work with than it will be using AHK. I am yet to find a website which has been harder to automate with javascript than with AHK.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 143 guests