How do I click and edit text fields in apps using Acc Libraries?
-
- Posts: 12
- Joined: 31 Mar 2022, 14:40
How do I click and edit text fields in apps using Acc Libraries?
I was able to make one script with autohotkey already, but it uses a long-winded series of SendInputs commands to manually move the mouse around and click on text fields.
I want to figure out how to use the Acc Library to click specific text fields and enter new values.
My problem is there is no solid ABSOLUTE BEGINNER friendly explanation on how to pull off such a simple task. I spent the entire day searching the autohotkey forum and found nothing that amply explained how it worked. I searched google as well, and got nothing helpful in other autohotkey site; and I searched YouTube for any tutorials that could help, but alas, El Zilcho
I need autohotkey to go into Davinci Resolve (free and beefy edition) and select a text field in the inspector window, specifically the zoom text field for instance, using the Acc Library.
I cannot figure out how to even begin going about it. I used the Accessible Info Viewer to find specific identifying properties to find the text fields, but then I immediately hit a brick wall when it came to:
1. Selecting the text field, and then
2. Interacting with it, namely double clicking the text field and replacing the current value with value
I tried my best to find anything that would help for the task, but couldn't find any pertinent info. I really am sorry if I seem incompetent, I genuinely couldn't find anything beginner-friendly to get even an iota of how that stuff works. I'm sorry
[Mod action: Moved from “Scripts and Functions”]
I want to figure out how to use the Acc Library to click specific text fields and enter new values.
My problem is there is no solid ABSOLUTE BEGINNER friendly explanation on how to pull off such a simple task. I spent the entire day searching the autohotkey forum and found nothing that amply explained how it worked. I searched google as well, and got nothing helpful in other autohotkey site; and I searched YouTube for any tutorials that could help, but alas, El Zilcho
I need autohotkey to go into Davinci Resolve (free and beefy edition) and select a text field in the inspector window, specifically the zoom text field for instance, using the Acc Library.
I cannot figure out how to even begin going about it. I used the Accessible Info Viewer to find specific identifying properties to find the text fields, but then I immediately hit a brick wall when it came to:
1. Selecting the text field, and then
2. Interacting with it, namely double clicking the text field and replacing the current value with value
I tried my best to find anything that would help for the task, but couldn't find any pertinent info. I really am sorry if I seem incompetent, I genuinely couldn't find anything beginner-friendly to get even an iota of how that stuff works. I'm sorry
[Mod action: Moved from “Scripts and Functions”]
Re: How do I click and edit text fields in apps using Acc Libraries?
I'm not an expert in Acc, but here is a tutorial in case it helps. viewtopic.php?p=272465
-
- Posts: 12
- Joined: 31 Mar 2022, 14:40
Re: How do I click and edit text fields in apps using Acc Libraries?
Yeah I saw this a bunch but it only makes you aware of what is possible, not so much on execution thoughmikeyww wrote: ↑01 Apr 2022, 16:02I'm not an expert in Acc, but here is a tutorial in case it helps. viewtopic.php?p=272465
Re: How do I click and edit text fields in apps using Acc Libraries?
The basic idea is that once you have identified the right "tree path", you can execute various commands or actions. I would dive into some of the links & examples, especially for JEE_AccGetTextAll, which you can call, and AccViewer Basic. You could also search the forum for accValue and accDoDefaultAction, as you may find additional examples related to your goal. If you search for Chrome Acc, you may find more examples there of how to get various information from Chrome, and you may be able to adapt some of the approaches.
-
- Posts: 12
- Joined: 31 Mar 2022, 14:40
Re: How do I click and edit text fields in apps using Acc Libraries?
I'll get to digging; thanks for the leads! BRB with any finds.mikeyww wrote: ↑01 Apr 2022, 19:48The basic idea is that once you have identified the right "tree path", you can execute various commands or actions. I would dive into some of the links & examples, especially for JEE_AccGetTextAll, which you can call, and AccViewer Basic. You could also search the forum for accValue and accDoDefaultAction, as you may find additional examples related to your goal. If you search for Chrome Acc, you may find more examples there of how to get various information from Chrome, and you may be able to adapt some of the approaches.
-
- Posts: 12
- Joined: 31 Mar 2022, 14:40
Re: How do I click and edit text fields in apps using Acc Libraries?
The most I could cobble together thus far:
I found code that identified the current window and read back the value of an Object path, so I thought "create a variable that contains the location of the zoom text box"
From there, call the variable and envoke what I thought was a function to enact the action of said object.
To reiterate, I need to enter a new value in the zoom box. Manually, you double click it and enter a value. I've already made a script that does this with SendInput commannds but,
I want to be able to accomplish this effect with out absolutely needing panels to be in specific positions prior to activating the hotkey.
Code: Select all
#+j::
WinGet, hWnd, ID, A
vAcc := Acc_Get("Object", "4.2.2.1.1.2.4.1.3.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.2.1", 0, "ahk_id" hWnd)
%vAcc%.accDoDefaultAction(0)
return
From there, call the variable and envoke what I thought was a function to enact the action of said object.
To reiterate, I need to enter a new value in the zoom box. Manually, you double click it and enter a value. I've already made a script that does this with SendInput commannds but,
I want to be able to accomplish this effect with out absolutely needing panels to be in specific positions prior to activating the hotkey.
Re: How do I click and edit text fields in apps using Acc Libraries?
Would you mind leaving of what Chrome/Edge release that path ID is? Thx
-
- Posts: 12
- Joined: 31 Mar 2022, 14:40
Re: How do I click and edit text fields in apps using Acc Libraries?
I'm working on a video editor actually. Not a browser
Re: How do I click and edit text fields in apps using Acc Libraries?
I do not have a way to test this, but you probably should not be using %.
Re: How do I click and edit text fields in apps using Acc Libraries?
@GimpyGosling I don't have the program you want to control but try this
Setting a value through Acc doesn't work for all elements. If it doesn't work in this case you can as a workaround try to use Acc to click/focus the element and then use Send to set text.
From jeeswg's thread viewtopic.php?p=272465
See viewtopic.php?f=76&t=91393&p=403858#p403858 for some notes.
Code: Select all
WinGet, hWnd, ID, A
vAcc := Acc_Get("Object", "4.2.2.1.1.2.4.1.3.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.2.1", 0, "ahk_id" hWnd)
vAcc.accValue(0) := "2" ; set value 2
From jeeswg's thread viewtopic.php?p=272465
Another thing to keep in mind is that very long Acc paths like that can be fragile and may change depending on what other controls and panes are shown or hidden in a complex application window. Sometimes using role name text for some nodes in the Acc path helps. Sometimes you need to make the hotkey try a few different Acc paths until the current correct one is found and only then use it.- Acc provides an accDoDefaultAction method, where available, this is usually equivalent to clicking on a GUI element/control.
- The accSelect method can be used to change the focused/selected items in a control e.g. a listview control.
- For *some* but not all GUI elements, you can set the element's value by specifying the text via accValue.
See viewtopic.php?f=76&t=91393&p=403858#p403858 for some notes.
-
- Posts: 12
- Joined: 31 Mar 2022, 14:40
Re: How do I click and edit text fields in apps using Acc Libraries?
@neogna2 I tried out your solution, unfortunately it didn't work either.
So I tried out your other suggestion of identifying the object and then clicking it.
Still didn't work, but am I headed in the right direction with this? I'm thinking "create a variable that identifies the text field in question"
then from there "create a variable containing the X,Y coordinates of the prior variable" and then click twice at those coordinates held in "location".
I get an error message saying something is wrong with my declaration of vAcc.
So I tried out your other suggestion of identifying the object and then clicking it.
Code: Select all
^F5::
vAcc := Acc_ObjectFromPath(Acc_ObjectFromWindow(Win), "4.2.2.1.1.2.4.1.3.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.2.1")
Location := Acc_Location(vAcc)
Click, Location, 2
return
then from there "create a variable containing the X,Y coordinates of the prior variable" and then click twice at those coordinates held in "location".
I get an error message saying something is wrong with my declaration of vAcc.
Re: How do I click and edit text fields in apps using Acc Libraries?
The location is an array. Below is one example with Chrome.
Code: Select all
#Include d:\utils\acc\Acc.ahk
accPath = 4.1.1.2.1.1.1.1
#IfWinExist ahk_exe chrome.exe
F3::
WinActivate
vAcc := Acc_Get("Object", accPath, 0, "ahk_id" WinExist())
pos := Acc_Location(vAcc)
MsgBox, 64, Position, % "x = " pos.x "`ny = " pos.y "`nw = " pos.w "`nh = " pos.h
CoordMode, Mouse
MouseMove, pos.x, pos.y
; MouseClick,, pos.x, pos.y
Return
#IfWinExist
-
- Posts: 12
- Joined: 31 Mar 2022, 14:40
Re: How do I click and edit text fields in apps using Acc Libraries?
@mikeyww I tried your code out, while it didn't go to the desired location IT DID DO SOMETHING as opposed to nothing before XD We're getting warmer!
I inserted the code and instead of going to the desired coordinates (1691, 206) it ends up going to (48,48) near the top left. Coordinates are relative to screen
I tried altering it by adjusting the Coordmode command to pixel and screen, and neither changed the outcome, still ends up at that top left corner
Code: Select all
^F11::
WinActivate
vAcc := Acc_Get("Object", 4.2.2.1.1.2.4.1.3.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.2.1, 0, "ahk_id" WinExist())
pos := Acc_Location(vAcc)
MsgBox, 64, Position, % "x = " pos.x "`ny = " pos.y "`nw = " pos.w "`nh = " pos.h
CoordMode, Mouse
MouseMove, pos.x, pos.y
return
Re: How do I click and edit text fields in apps using Acc Libraries?
You could try something like the following. Of course, if you have the wrong path, then you will get the wrong result!
Functions use expressions. The following demonstrates the potential issue.
Code: Select all
#Include d:\utils\acc\Acc.ahk
accPath = 4.2.2.1.1.2.4.1.3.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.2.1
^F11::
vAcc := Acc_Get("Object", accPath, 0, "ahk_id" WinActive("A"))
pos := Acc_Location(vAcc)
MsgBox, 64, Position, % "x = " pos.x "`ny = " pos.y "`nw = " pos.w "`nh = " pos.h
CoordMode, Mouse
MouseMove, pos.x, pos.y
Return
Code: Select all
t = 7.8.9
f(1) ; Expression
f(1.2.3) ; Not typically an expression
f("4.5.6") ; Expression
f(t) ; Expression
f(x) {
MsgBox #%x%#
}
-
- Posts: 12
- Joined: 31 Mar 2022, 14:40
Re: How do I click and edit text fields in apps using Acc Libraries?
Hey dude, sorry for not replying sooner! I tried out the code and it still gives me the same result. I am indeed using the correct path, but what is happening is it's acting as though I were specifyingmikeyww wrote: ↑04 Apr 2022, 13:18You could try something like the following. Of course, if you have the wrong path, then you will get the wrong result!
Functions use expressions. The following demonstrates the potential issue.Code: Select all
#Include d:\utils\acc\Acc.ahk accPath = 4.2.2.1.1.2.4.1.3.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.2.1 ^F11:: vAcc := Acc_Get("Object", accPath, 0, "ahk_id" WinActive("A")) pos := Acc_Location(vAcc) MsgBox, 64, Position, % "x = " pos.x "`ny = " pos.y "`nw = " pos.w "`nh = " pos.h CoordMode, Mouse MouseMove, pos.x, pos.y Return
Code: Select all
t = 7.8.9 f(1) ; Expression f(1.2.3) ; Not typically an expression f("4.5.6") ; Expression f(t) ; Expression f(x) { MsgBox #%x%# }
the incorrect path that's further up the line like 4.2.2.1.1 instead of going all the way through
Re: How do I click and edit text fields in apps using Acc Libraries?
I don't have a way to test it, but you sometimes need to try various paths before you find the right one.
Re: How do I click and edit text fields in apps using Acc Libraries?
@GimpyGosling Any Luck on this? I'm trying to do the exact same thing in Davinci?
Re: How do I click and edit text fields in apps using Acc Libraries?
@SteveMylo
In case you are new to this topic I’d recommend to go with UIA (the successor of ACC, see 'Scripts & Functions' forum section) that is meanwhile more on focus and therefore better supported.
This question is key, as using a path that is provided with any script in the forum gets most likely outdated after Chrome/Edge has been updated.
In case you are new to this topic I’d recommend to go with UIA (the successor of ACC, see 'Scripts & Functions' forum section) that is meanwhile more on focus and therefore better supported.
Re: How do I click and edit text fields in apps using Acc Libraries?
Yes I actually have just been researching the UAI, it's very good. Thank you for the suggestion.BoBo wrote: ↑22 Jun 2022, 01:02@SteveMyloThis question is key, as using a path that is provided with any script in the forum gets most likely outdated after Chrome/Edge has been updated.
In case you are new to this topic I’d recommend to go with UIA (the successor of ACC, see 'Scripts & Functions' forum section) that is meanwhile more on focus and therefore better supported.
Keep in mind the Orginal Quesiton has nothing to do with chrome or a Web browser, he/she is talking about Davinci Resolve Video Editing Software. It doesn't get updated very often nor would it even change at all.
It's Something that almost no one knows how to use the ACC library on NOR anything else cause Davinci Resolve hides their controls or whatever and isn't easily accessible if at all. I've been asking this question for a very long time and everyone seems to get stumped. But we are not giving up cause I Know it has to be possible.
I think keeping this thread open is very important.
Re: How do I click and edit text fields in apps using Acc Libraries?
Well, was just for the records. So is this, the (AFAICS) updated "AccViewer" that is able to identify acc-paths more reliably, kindly provided by @rommmcek : viewtopic.php?p=382050#p382050 + [Download]
HTH
HTH