Acc v2

Post your working scripts, libraries and tools.
Descolada
Posts: 1141
Joined: 23 Dec 2021, 02:30

Re: Acc v2

19 Jan 2023, 00:09

@Skrell, this runs only in AHK v2. You can safely assume that 95%+ of the scripts posted in the v2 section only run on v2 :)
Skrell
Posts: 302
Joined: 23 Jan 2014, 12:05

Re: Acc v2

19 Jan 2023, 10:09

Descolada wrote:
19 Jan 2023, 00:09
@Skrell, this runs only in AHK v2. You can safely assume that 95%+ of the scripts posted in the v2 section only run on v2 :)
OMG I'm an idiot sorry!
erinau
Posts: 2
Joined: 04 Apr 2023, 15:45

Problems with compiling

05 Apr 2023, 03:09

Hi,
I am having problems compiling my ahk files.
Even if I compile only the acc.ahk file I get error messages. Running the ahk files themselves works.

Error Message Text:
ACC.ahk(Line 261):==>This Line does not contain a recognized action. Specialy: #DllLoad eloacc
I compiled it with ahk2Exe v1.1.26.02e
Do I use the wrong ahk2exe

Any ideas?

regards
Erich
Descolada
Posts: 1141
Joined: 23 Dec 2021, 02:30

Re: Acc v2

05 Apr 2023, 04:29

@erinau, as far as I know, Ahk2Exe is currently only for AHK v1. This Acc v2 library is for AHK v2. Whether there is an Ahk2Exe for AHK v2, I don't know.
TAC109
Posts: 1112
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: Acc v2

05 Apr 2023, 04:38

@erinau @Descolada
There is only one compiler and it works for both versions. If you are compiling a v2 script you must select a v2 base file (AutoHotkey32.exe or AutoHotkey64.exe).

Cheers
My scripts:-
XRef - Produces Cross Reference lists for scripts
ReClip - A Text Reformatting and Clip Management utility
ScriptGuard - Protects Compiled Scripts from Decompilation
I also maintain Ahk2Exe
erinau
Posts: 2
Joined: 04 Apr 2023, 15:45

Re: Acc v2

05 Apr 2023, 05:14

@TAC109
Thanks for the fast reply. You were right. By default the wrong base file was choosen.

Regards
LAPIII
Posts: 668
Joined: 01 Aug 2021, 06:01

Re: Acc v2

19 May 2023, 10:12

Descolada wrote:
10 Dec 2022, 06:08
@neogna2, ... I implemented your AccGetPath as Element.GetPath, which also checks that the path is valid and if not then uses FindFirst (the top-down approach) to get the correct path. If no path is found then an empty string is returned. Usage: Acc.ObjectFromWindow("A").GetPath(Acc.ObjectFromPoint())
I would like to try this out, but I would know how to implement this and I ccouldn't get neogna2's snippet working in a hotkey:

Code: Select all

#Requires Autohotkey v2.0+
#Include <ACC>

1::{
;Get Acc object's path. Default: object at mouse pointer. (Helper function for v2 Acc library)
AccGetPath(oA := Acc.ObjectFromPoint() ) {
    oWin := Acc.ObjectFromWindow("ahk_id " oA.WinID)
    While !oA.IsEqual(oWin)
        for i, child in oP := oA.Parent
            if child.IsEqual(oA)
            {
                Path := IsSet(Path) ? i "," Path : i
                oA := oP
                break
            }
    return Path
}
}
Descolada
Posts: 1141
Joined: 23 Dec 2021, 02:30

Re: Acc v2

19 May 2023, 10:25

@LAPIII, you need to actually call the function, not just copy-paste the function definition.

Code: Select all

#Requires Autohotkey v2.0+
#Include <ACC>

1::{
    ToolTip AccGetPath()
}

2::{
    oPoint := Acc.ObjectFromPoint()
    ToolTip Acc.ObjectFromWindow(oPoint.WinID).GetPath(oPoint)
}

;Get Acc object's path. Default: object at mouse pointer. (Helper function for v2 Acc library)
AccGetPath(oA := Acc.ObjectFromPoint() ) {
    oWin := Acc.ObjectFromWindow("ahk_id " oA.WinID)
    While !oA.IsEqual(oWin)
        for i, child in oP := oA.Parent
            if child.IsEqual(oA)
            {
                Path := IsSet(Path) ? i "," Path : i
                oA := oP
                break
            }
    return Path
}
Note that AccGetPath doesn't work in my computer with Chromium windows (Chrome, VSCode), I think it gets stuck in an infinite loop.
LAPIII
Posts: 668
Joined: 01 Aug 2021, 06:01

Re: Acc v2

19 May 2023, 10:43

Thank you, this is awesome. Can I use if and else like you showed me that I can with UIA here?
Descolada
Posts: 1141
Joined: 23 Dec 2021, 02:30

Re: Acc v2

19 May 2023, 11:07

@LAPIII, yes, with Acc v2 you can use if-else, because FindElement doesn't throw an error when no element is found, rather returns nothing.
Zedcars
Posts: 11
Joined: 17 Sep 2021, 07:50

Re: Acc v2

05 Jul 2023, 15:10

Inextricably, after a Windows 10 update today Acc v2 stopped working for me. It has been working perfectly fine the day before and I’ve been using it for about 5 months. I’m able to load the viewer, but as soon as I attempt to capture Acc information a bunch of AHK errors are thrown up. Same situation with my own scripts using Acc. I can report back with the actual errors tomorrow (not able to access it at the moment). Is anyone else having problems running it recently? I wondered if there is anything I can do to get it running again. It is a work PC. Can IT just block access to the Accessibility library? It doesn’t matter which application I’m attempting to use it with, the errors are thrown regardless.
Descolada
Posts: 1141
Joined: 23 Dec 2021, 02:30

Re: Acc v2

05 Jul 2023, 23:07

@Zedcars, just tested on my Windows 10 (build 19045.3086) - no errors. I'm not sure whether and why IT would block Acc, perhaps post the errors first. Also you can try using the UIA library UIAViewer (run UIA.ahk to open it) to see whether that is broken as well.
Zedcars
Posts: 11
Joined: 17 Sep 2021, 07:50

Re: Acc v2

06 Jul 2023, 14:04

Descolada wrote:
05 Jul 2023, 23:07
@Zedcars, just tested on my Windows 10 (build 19045.3086) - no errors. I'm not sure whether and why IT would block Acc, perhaps post the errors first. Also you can try using the UIA library UIAViewer (run UIA.ahk to open it) to see whether that is broken as well.
Hi, thanks for your reply. UIA.ahk (v2) works without any errors. Here are the errors that appear when I try to use Acc v2. The first error is when using the Acc Viewer, the second error is when using my own script with Acc.
image.png
image.png (325.3 KiB) Viewed 868 times
image.png
image.png (156.84 KiB) Viewed 868 times
Zedcars
Posts: 11
Joined: 17 Sep 2021, 07:50

Re: Acc v2

09 Jul 2023, 12:59

I think I'll just convert the Acc code to UIA then as that works. It does seem odd though.
iamMG
Posts: 28
Joined: 12 Nov 2017, 11:32

Re: Acc v2

27 Mar 2024, 05:53

I am facing this error while using Acc v2 library.
image.png
image.png (126.82 KiB) Viewed 54 times
I have placed Acc.ahk in the Lib folder where the script is placed.
image.png
image.png (34.86 KiB) Viewed 54 times
What am I doing wrong? Here's the code:

Code: Select all

#requires AutoHotkey v2.0
#include <Acc>

#HotIf winActive("WhatsApp ahk_exe ApplicationFrameHost.exe")       ;	WHATSAPP
    ^e:: {
        WAWin := Acc.ElementFromHandle()
        emoj := WAWin[4,2,4,1,11]
        emoj.DoDefaultAction()
    }
#HotIf

Return to “Scripts and Functions (v2)”

Who is online

Users browsing this forum: DuyMinh and 72 guests