VBA to AHK Translator (Excel)

Post your working scripts, libraries and tools for AHK v1.1 and older
Wolf01
Posts: 2
Joined: 01 Apr 2018, 11:29
Contact:

Re: VBA to AHK Translator (Excel)

10 Jan 2022, 21:58

Hi,
I get this error when I run the script:
==> Call to nonexistent function.
Specifically: Acc_ObjectFromWindow(hwnd, -16)
Do I need more files in the script directory beside the vba to ahk translator script?
I notice that an Acc.ahk script is in another user's script folder but not in mine and I don't see the constants.txt either.
Thanks
AHK_user
Posts: 515
Joined: 04 Dec 2015, 14:52
Location: Belgium

Re: VBA to AHK Translator (Excel)

11 Jan 2022, 01:29

Wolf01 wrote:
10 Jan 2022, 21:58
Hi,
I get this error when I run the script:
==> Call to nonexistent function.
Specifically: Acc_ObjectFromWindow(hwnd, -16)
Do I need more files in the script directory beside the vba to ahk translator script?
I notice that an Acc.ahk script is in another user's script folder but not in mine and I don't see the constants.txt either.
Thanks
Yes, you need the following files, this is mentioned in the first post:
https://github.com/dmtr99/VBAtoAHK/raw/main/Acc.ahk
https://github.com/dmtr99/VBAtoAHK/blob/main/Constants.txt
Wolf01
Posts: 2
Joined: 01 Apr 2018, 11:29
Contact:

Re: VBA to AHK Translator (Excel)

15 Jan 2022, 17:57

Thank you, downloaded both and all working
wei9133
Posts: 11
Joined: 08 Sep 2014, 13:01

Re: VBA to AHK Translator (Excel)

21 Apr 2022, 06:42

Hi @AHK_user
this script not work
Acc.ahk
Constants.txt
are placed in the same folder
OS : win10
Image
Image
Image
The path is already in English
Or where am I doing wrong?

If the picture does not show, please open the link below
https://imgur.com/a/CE6Rb6p
https://imgur.com/dXT9vfc
https://imgur.com/VBe2yPN

;================return result=================
Currently available, need to VBAtoAHK.ahk Increase
#Include %A_ScriptDir%\acc.ahk

注意事項:
腳本運行要三個要件,分別是
VBAtoAHK.ahk ;主要腳本
Acc.ahk ;資料庫
Constants.txt ;常數庫

網頁裡有提到這三個都要存在,但VBAtoAHK.ahk並沒有直接連接Acc.ahk
所以要把三個檔案都放同一個資料夾裡後,在VBAtoAHK.ahk內文裡加上連接
#Include %A_ScriptDir%\acc.ahk ;就是這一句
然後就可以正常使用了。
需要注意的部分有,當VBA內有空格的時候,可以嘗試直接刪掉,以免報錯
然後再執行看看是否正常運作如果不正常就再想辦法囉。
AHK_user
Posts: 515
Joined: 04 Dec 2015, 14:52
Location: Belgium

Re: VBA to AHK Translator (Excel)

23 Apr 2022, 09:25

@wei9133
Check if acc.ahk is correctly loaded, and the function acc_ObjectFromWindow is present.
Mork_Learn
Posts: 8
Joined: 02 May 2022, 04:31

Re: VBA to AHK Translator (Excel)

02 May 2022, 04:36

Hello,

im getting the below error on both Scripts. All files are in the same folder.
Capture.JPG
Capture.JPG (24.93 KiB) Viewed 1912 times
gregster
Posts: 9085
Joined: 30 Sep 2013, 06:48

Re: VBA to AHK Translator (Excel)

02 May 2022, 07:35

Mork_Learn wrote:
02 May 2022, 04:36
Hello,

im getting the below error on both Scripts. All files are in the same folder.

Capture.JPG
That doesn't look like Acc.ahk (compare https://raw.githubusercontent.com/dmtr99/VBAtoAHK/main/Acc.ahk) or any AHK script.
Did you download some webpage source or html instead?
Mork_Learn
Posts: 8
Joined: 02 May 2022, 04:31

Re: VBA to AHK Translator (Excel)

02 May 2022, 08:11

I downloaded all the files straight from the GitHub page linked by the OP.
gregster
Posts: 9085
Joined: 30 Sep 2013, 06:48

Re: VBA to AHK Translator (Excel)

02 May 2022, 09:31

Well, the error message tells you that something went wrong. It looks like you didn't use github correctly.

Obviously, the error message doesn't show AHK code, but some source code from a github webpage. I assume you downloaded a page source, not the actual files.
This is from the html source of https://github.com/dmtr99/VBAtoAHK . But it could also be some other github page, like https://github.com/dmtr99/VBAtoAHK/blob/main/Constants.txt

github source code.png
github source code.png (4.5 KiB) Viewed 1868 times
Looks suspiciously like the text in the error message. :geek:

Please compare the downloaded files with the AHK source code shown on github and in the OP. Those are all text files. This should be straightforward.

And then re-download the project files in "Raw" format (either copy/paste or right-click on the corresponding button, then save target).

Raw button.png
Raw button.png (2.8 KiB) Viewed 1843 times

Since the link to Acc.ahk from the OP already links to the raw format (https://raw.githubusercontent.com/dmtr99/VBAtoAHK/main/Acc.ahk), you perhaps missed the Raw button on https://github.com/dmtr99/VBAtoAHK/blob/main/Constants.txt which would lead you here:
https://raw.githubusercontent.com/dmtr99/VBAtoAHK/main/Constants.txt
Mork_Learn
Posts: 8
Joined: 02 May 2022, 04:31

Re: VBA to AHK Translator (Excel)

02 May 2022, 23:06

Hi Gregster,

Not sure what i did on Github. But all good got it to work.

Thanks heaps. :)
User avatar
ZakMcKrackenDE
Posts: 11
Joined: 28 Sep 2022, 07:48

Re: VBA to AHK Translator (Excel)

08 Oct 2022, 05:19

Thanks for that amazing skript. I search so long for a developer tool. i try xojo, livecode etc, but AHK kick them all out, because the possibility to automate office without any addons etc and compile in small exe-files, is my personal game changer. I wonder, if that tool is available for PPT VBA. PPT VBA are so rare....
burque505
Posts: 1736
Joined: 22 Jan 2017, 19:37

Re: VBA to AHK Translator (Excel)

08 Oct 2022, 15:08

@ZakMcKrackenDE, I'm not sure if this is what you're looking for, but you might have a look at ppt_get.ahk.
carno
Posts: 265
Joined: 20 Jun 2014, 16:48

Re: VBA to AHK Translator (Excel)

15 Dec 2022, 11:25

Is there any AHK to VBA translator?
AHK_user
Posts: 515
Joined: 04 Dec 2015, 14:52
Location: Belgium

Re: VBA to AHK Translator (Excel)

16 Dec 2022, 06:24

carno wrote:
15 Dec 2022, 11:25
Is there any AHK to VBA translator?
Nope, only a limited number of commands could be converted to VBA, AHK has more possibilities.

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: No registered users and 84 guests